Edit File
edit_fileMake line-based text file edits by replacing exact oldText with newText in order; preview changes via diff and write nothing if any match is ambiguous or missing.
Instructions
Make line-based edits to a text file. Edits apply in order, each replacing oldText with newText. oldText must match exactly one place (include enough surrounding lines to be unique), or set replaceAll to replace every match. Line endings and leading/trailing whitespace on whole lines are ignored when there is no exact match. If any edit has no match or an ambiguous one, nothing is written. Returns a git-style diff.
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>",
"edits": "<edits>"
},
"name": "edit_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path, or relative to the server's working directory. | |
| edits | Yes | The replacements to make, applied in order. Each oldText must match exactly one place unless replaceAll is set. | |
| dryRun | No | Preview changes using git-style diff format |