file_edit
Replace an exact string in a file with another string using JSON parameters, bypassing shell escaping issues.
Instructions
Replace a unique string in a file with another string. old_str must match the raw file content exactly and appear exactly once. Use this instead of shell-based sed/python for all file edits — content goes through JSON parameters, never a shell, so there are no escaping issues.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path to the file to edit. Tilde (~) is expanded to the proot home directory. | |
| new_str | No | The replacement string. Use empty string to delete old_str. | |
| old_str | Yes | The exact string to find. Must appear exactly once in the file. |