edit
Replace text in a file using OpenCode matching semantics, preserving exact indentation from read output. Use replaceAll to replace every occurrence or add context when the match is ambiguous.
Instructions
Replace text in a file using OpenCode matching semantics. Preserve the exact indentation from read output, excluding its line-number prefix. The operation fails when oldString cannot be identified unambiguously; supply more context or use replaceAll to replace every occurrence.
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": {
"filePath": "<filePath>",
"oldString": "<oldString>",
"newString": "<newString>"
},
"name": "edit"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | The absolute path to the file to modify | |
| newString | Yes | The text to replace it with (must be different from oldString) | |
| oldString | Yes | The text to replace | |
| replaceAll | No | Replace all occurrences of oldString (default false) |