str_replace
Replace a specific substring in a file, verifying uniqueness to avoid errors, for precise small edits.
Instructions
Surgical edit: replace a literal substring in a file. Default occurrence='unique' (errors on >1 match). Tiny payload in/out; preferred over file.replace for any edit smaller than the whole file.
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": {
"file": "<file>",
"find": "<find>",
"replace": "<replace>"
},
"name": "str_replace"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | Yes | ||
| find | Yes | ||
| vault | No | ||
| dry_run | No | ||
| replace | Yes | ||
| occurrence | No | ||
| expected_content_hash | No |