Execute file operations on virtual file system.
file_tool(
runtime: ToolRuntime[None, AnthropicToolsState],
command: str,
path: str,
file_text: str | None = None,
old_str: str | None = None,
new_str: str | None = None,
insert_line: int | None = None,
new_path: str | None = None,
view_range: list[int] | None = None
) -> Command | str| Name | Type | Description |
|---|---|---|
runtime* | ToolRuntime[None, AnthropicToolsState] | Tool runtime providing access to state. |
command* | str | Operation to perform. |
path* | str | File path to operate on. |
file_text | str | None | Default: NoneFull file content for create command. |
old_str | str | None | Default: NoneString to replace for str_replace command. |
new_str | str | None | Default: NoneReplacement string for str_replace command. |
insert_line | int | None | Default: NoneLine number for insert command. |
new_path | str | None | Default: NoneNew path for rename command. |
view_range | list[int] | None | Default: NoneLine range |