schrodinger.application.bunsen.filesystem_tools module¶
Filesystem tool provider for Bunsen.
Gives Bunsen scoped access to a single local directory. Access is
disabled by default; call filesystem_provider.setDir(path) to enable.
- class schrodinger.application.bunsen.filesystem_tools.FilesystemProvider(parent=None)¶
Bases:
ProviderProvider that gives Bunsen scoped access to a local directory.
All tool operations are restricted to the directory set via
setDir. When the directory isNone(the default), all tools will return an error.- __init__(parent=None)¶
- setDir(path: str | None)¶
Set the scoped directory, or
Noneto disable access.- Parameters:
path – Absolute path to the directory, or None.
- getDir() str | None¶
Return the current scoped directory, or
Noneif disabled.
- resolvePath(relative_path: str) str¶
Resolve a relative path within the scoped directory.
- Parameters:
relative_path – Path relative to the scoped directory.
- Returns:
Absolute path guaranteed to be within the scoped dir.
- Raises:
ValueError – If access is disabled or the path escapes the scoped directory.
- class schrodinger.application.bunsen.filesystem_tools.ListDirTool(call_id: str, args: dict, parent=None)¶
Bases:
Tool- PROVIDER = <schrodinger.application.bunsen.filesystem_tools.FilesystemProvider object>¶
- NAME: str = 'list_dir'¶
- DESCRIPTION: str = 'List directory contents with metadata.'¶
- PARAMS: tuple[ToolParam, ...] = (ToolParam(name='path', type='string', description='Relative path within the scoped directory. Omit to list the root.'),)¶
- main(path: str = './')¶
The main function is responsible for calling self.sendResponse() itself or in a downstream callback or slot. This allows for both synchronous and asynchronous tool implementations.
- class schrodinger.application.bunsen.filesystem_tools.ReadFileTool(call_id: str, args: dict, parent=None)¶
Bases:
Tool- PROVIDER = <schrodinger.application.bunsen.filesystem_tools.FilesystemProvider object>¶
- NAME: str = 'read_file'¶
- DESCRIPTION: str = 'Read a file from the scoped directory.'¶
- PARAMS: tuple[ToolParam, ...] = (ToolParam(name='path', type='string', description='Relative path to the file.'),)¶
- RESPONSE_FILES: tuple[str, ...] = ('file',)¶
- main(path: str)¶
The main function is responsible for calling self.sendResponse() itself or in a downstream callback or slot. This allows for both synchronous and asynchronous tool implementations.
- class schrodinger.application.bunsen.filesystem_tools.WriteFileTool(call_id: str, args: dict, parent=None)¶
Bases:
Tool- PROVIDER = <schrodinger.application.bunsen.filesystem_tools.FilesystemProvider object>¶
- NAME: str = 'write_file'¶
- DESCRIPTION: str = 'Write a file to the scoped directory.'¶
- PARAMS: tuple[ToolParam, ...] = (ToolParam(name='path', type='string', description='Destination path within the scoped directory.'), ToolParam(name='file', type='file', description='File to write.'))¶
- main(path: str, file: str)¶
The main function is responsible for calling self.sendResponse() itself or in a downstream callback or slot. This allows for both synchronous and asynchronous tool implementations.
- class schrodinger.application.bunsen.filesystem_tools.DeleteTool(call_id: str, args: dict, parent=None)¶
Bases:
Tool- PROVIDER = <schrodinger.application.bunsen.filesystem_tools.FilesystemProvider object>¶
- NAME: str = 'delete'¶
- DESCRIPTION: str = 'Delete a file or empty directory.'¶
- PARAMS: tuple[ToolParam, ...] = (ToolParam(name='path', type='string', description='Relative path to delete.'),)¶
- main(path: str)¶
The main function is responsible for calling self.sendResponse() itself or in a downstream callback or slot. This allows for both synchronous and asynchronous tool implementations.
- class schrodinger.application.bunsen.filesystem_tools.MakeDirTool(call_id: str, args: dict, parent=None)¶
Bases:
Tool- PROVIDER = <schrodinger.application.bunsen.filesystem_tools.FilesystemProvider object>¶
- NAME: str = 'make_dir'¶
- DESCRIPTION: str = 'Create a directory, including intermediate directories.'¶
- PARAMS: tuple[ToolParam, ...] = (ToolParam(name='path', type='string', description='Relative path of the directory to create.'),)¶
- main(path: str)¶
The main function is responsible for calling self.sendResponse() itself or in a downstream callback or slot. This allows for both synchronous and asynchronous tool implementations.