update_file
Replace a selected line range in an existing UTF-8 text file. Re-read the file between updates to avoid line-number shifts.
Instructions
Replace an inclusive 1-based line range in an existing UTF-8 text file. Line numbers shift after every edit, so read the file again between updates.
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>",
"start_line": "<start_line>",
"end_line": "<end_line>",
"content": "<content>"
},
"name": "update_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path relative to the workspace root, or an allowed absolute path. | |
| content | Yes | Replacement content; an empty string deletes the selected lines. | |
| end_line | Yes | Last line to replace (inclusive). | |
| start_line | Yes | First line to replace (1-based). | |
| expected_sha256 | No | Optional SHA-256 returned by a previous read or write. The call fails if the file changed since then. |