edit_file
Edit files by exact string find-and-replace without rewriting the whole file. Specify a unique old string and replacement text, or enable replace_all to update every match.
Instructions
Edit a file via exact string find-and-replace, without rewriting the whole file. old_str must match exactly and be unique unless replace_all is set.
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>",
"new_str": "<new_str>"
},
"name": "edit_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| new_str | Yes | Text to replace it with | |
| old_str | Yes | Exact text to find | |
| replace_all | No | Replace every occurrence instead of requiring uniqueness |