Edit File
edit_fileMake line-based text file edits by replacing exact oldText with newText in order, with optional replaceAll and dry-run diff preview. Writes nothing if any edit fails to match.
Instructions
Make line-based edits to a text file, applied in order: each replaces oldText with newText. oldText must match exactly one place (add surrounding lines to make it unique) unless replaceAll is set. When there is no exact match, line endings and leading/trailing whitespace on whole lines are ignored. 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, applied in order. | |
| dryRun | No | If true, return the diff without changing the file (default false). |