mirror of
https://github.com/hanzoai/python-sdk.git
synced 2026-11-23 04:31:13 +00:00
`fs` apply_patch required a base_hash from a prior read, and its schema never said so: a model called it, was refused, read, retried. With enso-auto that was 5-15 failing calls per edit and hundreds of thousands of cached input tokens (hanzo-inc/cloud#758). A missing parameter surfaced as a Python TypeError (INTERNAL_ERROR), not a sentence the model could act on. Same contract as the Rust runtime (hanzoai/mcp#41) and the TypeScript tool: - base_hash is optional. Sent, a stale edit is still refused (CONFLICT). Omitted, old_text must match exactly once, so one call edits a file. - The action's schema names uri, old_text and new_text as required and base_hash as optional, in the Rust tool's words. - Missing old_text/new_text is INVALID_PARAMS saying what apply_patch takes; a `*** Begin Patch` text sent as `input` is pointed at action "patch". Test: pkg/hanzo-tools-fs/tests/test_fs_tools.py TestFsApplyPatch, 4 of 5 red before (the stale-hash case already held), 12/12 after. Refs hanzo-inc/cloud#758 Co-Authored-By: Claude Opus 5.5 <[email protected]>
hanzo-tools-fs
Filesystem tools for Hanzo MCP.
Installation
pip install hanzo-tools-fs
Tools
read - Read Files
read(file_path="/path/to/file.py")
read(file_path="/path/to/file.py", offset=100, limit=50)
write - Write Files
write(file_path="/path/to/file.py", content="...")
edit - Edit Files
edit(
file_path="/path/to/file.py",
old_string="def old():",
new_string="def new():"
)
tree - Directory Structure
tree(path="/project", depth=3)
find - File Discovery
find(pattern="*.py", path="/project")
search - Content Search
search(pattern="TODO|FIXME", path="./src")
ast - Code Structure
ast(pattern="class.*Service", path="/src")
License
MIT