File ops
15 tools for reading, writing, editing, searching, and watching files on the local filesystem.
Read & write
| Tool | Parameters | Description |
|---|---|---|
read_file | path, encoding? | Read the full contents of a file as a string. Supports text and binary (base64) files. |
write_file | path, content | Write content to a file, creating it if it doesn't exist. Overwrites by default. |
create_directory | path | Create a directory (and all missing parents) at the given path. |
list_directory | path, recursive? | List the contents of a directory. Returns file names, types, and sizes. |
Edit & patch
| Tool | Parameters | Description |
|---|---|---|
edit_file | path, old_string, new_string | Replace an exact string occurrence in a file. Safer than write_file for targeted edits. |
patch_file | path, patch | Apply a unified diff patch to a file. Useful for multi-hunk changes generated by the agent. |
file_diff | path1, path2 | Compare two files and return a unified diff. Used to review changes before applying. |
Search & find
| Tool | Parameters | Description |
|---|---|---|
search_files | pattern, root?, context_lines? | Search file contents with a regex pattern. Returns matching lines with file path and line number. |
find_files | pattern, root? | Find files by name pattern (glob-style). Returns matching file paths. |
glob_find | glob, root? | Find files matching a glob pattern like src/**/*.ts. |
Copy, move, delete
| Tool | Parameters | Description |
|---|---|---|
file_copy | src, dst | Copy a file from source to destination path. |
file_move | src, dst | Move or rename a file. |
file_delete | path | Delete a file. Fails on directories — use run_command with rm -rf for directories. |
Watch
| Tool | Parameters | Description |
|---|---|---|
file_watch | path, duration_secs? | Watch a file or directory for changes. Returns a list of change events (created, modified, deleted) over the watch period. |