edit_file
Perform precise search-and-replace in existing UTF-8 files, ensuring the old string matches exactly once, or replace all occurrences with a single operation.
Instructions
Search-and-replace in an existing UTF-8 file: old_string must be non-empty and match exactly once unless replace_all is true. Read the file first and copy the exact span. Output uses newline='\n' like write_file.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| new_string | Yes | ||
| old_string | Yes | ||
| replace_all | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |