edit_file
Perform precise search-and-replace in existing UTF-8 files, ensuring the old string matches exactly once, or replace all occurrences with a single operation.
Instructions
Search-and-replace in an existing UTF-8 file: old_string must be non-empty and match exactly once unless replace_all is true. Read the file first and copy the exact span. Output uses newline='\n' like write_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_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| new_string | Yes | ||
| old_string | Yes | ||
| replace_all | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |