edit_file
Edit files by replacing exact text with new content. Specify the unique text to find and its replacement, or enable replace_all for multiple occurrences.
Instructions
Make targeted edits to a file using find-and-replace. Provide the exact text to find (old_string) and its replacement (new_string). By default, old_string must appear exactly once (fails if ambiguous). Set replace_all=true to replace all occurrences. ALWAYS read the file first to get the exact text to replace. Requires allow_file_write in ~/.syscontrol/config.json.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute or home-relative path to the file to edit. | |
| new_string | Yes | Replacement text. Use empty string to delete the matched text. | |
| old_string | Yes | Exact text to find in the file. Must be unique unless replace_all=true. | |
| replace_all | No | Replace all occurrences instead of requiring uniqueness (default false). |