edit_file
Replace exact text in one file atomically, supporting batch edits, replaceAll, and post-edit compiler/linter diagnostics with a checkpoint ID.
Instructions
Replace exact text in one file. Either oldText/newText, or edits: [{oldText,newText,replaceAll}] applied atomically in order. oldText must match exactly once unless replaceAll. Reports diagnostics and a checkpoint id.
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": {
"path": "<path>"
},
"name": "edit_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | File path | |
| check | No | Run compilers/linters on the changed files afterwards (default true) | |
| edits | No | ||
| newText | No | ||
| oldText | No | ||
| replaceAll | No | ||
| expectedSha256 | No | Optional optimistic precondition from file_info; refuse the edit if the file changed |