file_ops
Perform file-system operations such as reading, writing, editing, moving, copying, hashing, compressing, and checking files, with concurrency-safe atomic writes to prevent corruption.
Instructions
Comprehensive file system operations with concurrency-safe writes.
Operations: read_file, write_file, edit_file, delete_file, move_file, copy_file, read_file_lines, read_multiple_files, file_exists, get_file_info, head_file, tail_file, undo_edit, get_file_hash, append_file, touch_file, compress, decompress.
Line indexing: read_file_lines offset is a 0-based line index
(0 = first line of the file). The response echoes offset/limit plus
first_line_number (1-based number of the first returned line, null when
empty) so callers can chain pages via next_steps without guessing.
Write operations (write_file, edit_file, move_file, copy_file) use per-path asyncio.Lock + atomic os.replace() to prevent corruption under concurrent access.
Args: See Parameters block.
Return Format
{"success": bool, "action": str, "message": str, "result": {...}}
success: whether the operation succeeded
action: the operation performed (e.g. "read_file")
message: natural-language summary for the user
result: operation-specific payload (file content, info dict, moved path, etc.) On failure, returns {"success": false, "error": str, "error_type": str, "suggestions": [...]}.
Examples
file_ops(operation="read_file", path="C:/Users/me/notes.md") file_ops(operation="write_file", path="D:/data/out.txt", content="hello") file_ops(operation="edit_file", path="D:/data/app.py", old_string="foo", new_string="bar") file_ops(operation="copy_file", path="a.txt", destination_path="b.txt")
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | ||
| limit | No | ||
| lines | No | ||
| offset | No | ||
| content | No | ||
| new_str | No | ||
| old_str | No | ||
| encoding | No | utf-8 | |
| is_regex | No | ||
| no_backup | No | ||
| operation | No | ||
| overwrite | No | ||
| check_type | No | file | |
| file_paths | No | ||
| new_string | No | ||
| old_string | No | ||
| replace_all | No | ||
| replacements | No | ||
| allow_multiple | No | ||
| archive_format | No | zip | |
| create_parents | No | ||
| ensure_newline | No | ||
| hash_algorithm | No | sha256 | |
| follow_symlinks | No | ||
| include_content | No | ||
| destination_path | No | ||
| max_content_size | No | ||
| max_file_size_mb | No | ||
| ignore_whitespace | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||