`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]>