fs_edit_file
Apply text replacements in a file by specifying old and new text strings. Preserves original BOM and line endings.
Instructions
Apply one or more old→new text replacements to an existing file.
Preserves the file's original BOM and line-ending style (CRLF/LF). Each edit must supply "old_text" (unique substring) and "new_text".
Returns: {"path", "bytes_written", "bom_preserved", "eol_style"}.
Raises on: empty old_text, text not found, duplicate matches, overlapping edits, replacement produces identical content.
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>",
"edits": "<edits>"
},
"name": "fs_edit_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| edits | Yes |