Files
d38b004368
Hanzo CI/CD / test (linux-amd64) (push) Skipped
Hanzo CI/CD / test (linux-arm64) (push) Skipped
Hanzo CI/CD / test-advisory (push) Skipped
Hanzo CI/CD / test-amd64 (push) Successful in 3m22s
Hanzo CI/CD / cicd (push) Failing after 5m5s
CI/CD / cicd (push) Failing after 8m37s
hanzo-tools-fs 0.3.5: fs apply_patch edits in one call; base_hash optional (cloud#758) (#52)
`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]>
2026-11-19 13:10:43 -05:00
..

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(pattern="TODO|FIXME", path="./src")

ast - Code Structure

ast(pattern="class.*Service", path="/src")

License

MIT