file_replace_text
Replace literal text in files with staged exact or normalized matching, first/all replacement, and an undoable operation ID.
Instructions
Replace literal text and return operation_id, undo_available and the match stage.
Matching is staged and the result always names the stage: exact first,
then normalised (indentation and trailing whitespace tolerated, the
replacement re-based onto the matched indentation), then a NO_MATCH
refusal carrying the nearest candidate lines. match is required and is
either first or all; there is no default policy. match_count reports the
matches found, expected_match_count refuses a different number, and
expected_content pins the exact text of one region.
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": "<old>",
"new": "<new>",
"match": "<match>"
},
"name": "file_replace_text"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| new | Yes | ||
| old | Yes | ||
| path | Yes | ||
| match | Yes | replacement policy: 'first' or 'all' | |
| dry_run | No | ||
| expected_hash | No | ||
| expected_content | No | ||
| expected_match_count | No | ||
| i_accept_secret_write_risk | No |