edit_block
Search and replace text in a file with support for whitespace flexibility, escape normalization, encoding options, and conflict detection.
Instructions
Search and replace text in a file.
Args: file_path: Absolute path to the file. old_string: Text to find. new_string: Replacement text. expected_replacements: Required match count (default 1). expected_mtime: Conflict detection timestamp. ignore_whitespace: Match with flexible whitespace. normalize_escapes: Unescape \n, \t, etc. in search. encoding: File encoding (utf-8, gbk, gb2312).
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_path": "<file_path>",
"old_string": "<old_string>",
"new_string": "<new_string>"
},
"name": "edit_block"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | ||
| old_string | Yes | ||
| new_string | Yes | ||
| expected_replacements | No | ||
| expected_mtime | No | ||
| ignore_whitespace | No | ||
| normalize_escapes | No | ||
| encoding | No | utf-8 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||