edit_file
Replace a specific, unique string in a file to modify its content while maintaining file structure and updating its cached summary.
Instructions
Edit a file by replacing a specific string. The file becomes (or remains) the active file.
The old_string must:
Match exactly, including whitespace and indentation
Appear exactly once in the file (for safety)
After editing, the file's cached summary is updated.
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_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path to the file to edit | |
| old_string | Yes | The exact string to replace (must be unique in the file) | |
| new_string | Yes | The string to replace it with |