write_file_surgical
Replace a code symbol in a file. Preview changes in a dry-run phase, then apply with a confirmation token.
Instructions
Replace a symbol with new code. Phase 1 (dry-run): returns diff + token. Phase 2: confirm with token to apply.
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": {
"filePath": "<filePath>",
"projectRoot": "<projectRoot>",
"symbolName": "<symbolName>"
},
"name": "write_file_surgical"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | Absolute path to file | |
| projectRoot | Yes | Project root (REQUIRED) | |
| symbolName | Yes | Symbol to replace | |
| newContent | No | New code (Phase 1 only ΓÇö omit in Phase 2, server uses stored content) | |
| className | No | Class name (optional, for scoping) | |
| confirm | No | Set true to apply a pending operation (Phase 2) | |
| confirmationToken | No | Token from Phase 1 dry-run (Phase 2 only) | |
| diffFormat | No | Diff verbosity in Phase 1 output (default: unified). Use none to skip diff and save tokens. |