edit_block
Search and replace text in files with options for match validation, whitespace handling, and conflict detection to modify code or content.
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).
Input Schema
TableJSON 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 |