String Replace
str_replaceReplace an exact, unique string in a file using absolute paths; omit the replacement to delete it. Fails if the target appears zero or multiple times.
Instructions
Replace an exact string in a file.
old_str must match exactly and be unique in the file
If old_str appears 0 times or more than once, the operation fails
If new_str is omitted, old_str is deleted
Use absolute paths
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_str": "<old_str>"
},
"name": "str_replace"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path to file | |
| new_str | No | Replacement string (omit to delete) | |
| old_str | Yes | Exact string to find (must be unique) |