FileTools
Claude Code-style file operations with read-before-edit tracking and permission control.
Quick Start
Key Features
1. Read-Before-Edit Validation
FileTools tracks which files have been read and prevents edits without prior reads:
2. Stale Read Detection (MD5 Snapshots)
Detects external file changes between read and edit:
3. write() for NEW Files Only
write() prevents overwriting existing files:
4. Permission Modes
API Reference
read_file(path, offset=None, limit=None)
Read file with line numbers. Automatically tracks MD5 snapshot.
edit(file_path, old_string, new_string, replace_all=False)
Replace string in file. Validates read-before-edit and detects stale reads.
multi_edit(file_path, edits)
Apply multiple edits atomically. All succeed or none applied.
write(path, content)
Create NEW files only. Returns error if file exists.
glob(pattern, path=None)
Search files by glob pattern. Returns max 100 results.
grep(pattern, path=None, ...)
Search file contents with regex. Supports multiple output modes.
Usage Examples
File editing agent with safety
Read-only documentation agent
Code generation agent
Backward Compatibility
Individual functions still available without FileTools wrapper:
