Edit File
edit_fileReplace target strings in a file with occurrence limits and a diff preview to verify changes before saving.
Instructions
Replace target string with replacement text in a file with occurrence control and diff preview.
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 | Relative or absolute path to the file. | |
| count | No | Number of occurrences to replace (0 = replace all, 1 = first only). | |
| new_string | Yes | The replacement string. | |
| old_string | Yes | The exact string to find (case-sensitive, whitespace-sensitive). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |