apply_text_patch
Apply precise text replacements to local files with SHA-256 verification, ensuring exact matches and unique request IDs for safe, recoverable edits.
Instructions
Apply 1-64 literal replacements to an existing UTF-8 file <=8 MiB. Each edit has old/new text and exact match count (default 1); ambiguous matches are refused. Requires rw, observed SHA-256 and unique request_id. Preserves untouched content, BOM/newlines and permissions. Returns change_id for recovery.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"workspace": "<workspace>",
"path": "<path>",
"edits": "<edits>",
"expected_sha256": "<expected_sha256>",
"request_id": "<request_id>"
},
"name": "apply_text_patch"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| edits | Yes | ||
| workspace | Yes | ||
| request_id | Yes | ||
| expected_sha256 | Yes |