file_edit
Replace an exact string in a file with another string using JSON parameters, bypassing shell escaping issues.
Instructions
Replace a unique string in a file with another string. old_str must match the raw file content exactly and appear exactly once. Use this instead of shell-based sed/python for all file edits — content goes through JSON parameters, never a shell, so there are no escaping issues.
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_str": "<old_str>"
},
"name": "file_edit"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path to the file to edit. Tilde (~) is expanded to the proot home directory. | |
| new_str | No | The replacement string. Use empty string to delete old_str. | |
| old_str | Yes | The exact string to find. Must appear exactly once in the file. |