edit
Replace a unique substring in a file with new text, requiring a prior read and returning a unified diff.
Instructions
Replace old_string with new_string in file_path.
Requirements (matches opencode):
You must call
readon this file in the same session first.old_stringmust appear exactly once in the current file content. Provide more surrounding context if it isn't unique.The file must not have changed since the last
read.
Returns a unified diff of the change.
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 | ||
| newString | Yes | ||
| oldString | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |