Edit File
editApply targeted exact text replacement in workspace files and receive a unified diff to review changes.
Instructions
Apply a targeted exact text replacement inside a workspace text file. Returns a unified diff.
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_text": "<old_text>",
"new_text": "<new_text>"
},
"name": "edit"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | File path relative to workspace root. | |
| new_text | Yes | Replacement text. | |
| old_text | Yes | Exact text to replace. Must match once unless replace_all=true. | |
| replace_all | No | Replace all occurrences. Default: false. | |
| workspace_id | No | Workspace id from open_workspace. Omit to use default workspace. | |
| expected_replacements | No | Fail if actual replacement count differs. |