Surgical replace
surgical_replaceApply exact-match code replacements across one or more files as a single atomic transaction; if any snippet fails, no files are written. Use dry_run to preview a unified diff.
Instructions
Transactional exact-match editor. Send ONLY the minimal snippets to change, across one or more files. Each find must appear exactly once in its file. All operations are atomic: if any replacement fails, no file is written. On a miss, the error points to the most similar line so you can retry without re-reading. Set dry_run to get a unified diff without writing.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "surgical_replace"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dry_run | No | Validate and return a unified diff without writing. Default false. | |
| file_path | No | Legacy single-file form; prefer `operations`. | |
| operations | No | Edits to apply as one transaction. Operations on the same file compose in order. | |
| replacements | No | Legacy single-file form; used with `file_path`. |