edit
Replace exact text in a file to make targeted changes without rewriting entire content.
Instructions
Performs exact string replacement in a file. Useful for making partial changes to an existing file.
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>",
"old_string": "<old_string>",
"new_string": "<new_string>"
},
"name": "edit"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | The path to the file to edit. | |
| new_string | Yes | The text to replace it with. This will be inserted exactly as provided. | |
| old_string | Yes | The exact text to replace. IMPORTANT: This must match the file contents exactly, including all indentation, newlines, and whitespace. If you previously read the file with line numbers, you must strip them before matching. | |
| replace_all | No | Whether to replace all occurrences. Set to `true` to replace every instance instead. IMPORTANT: If `false` or omitted, the edit will fail if `old_string` appears more than once in the file. Defaults to `false` if not specified. |