edit
Replace exact text in a file to make targeted changes without rewriting entire content.
Instructions
Performs exact string replacement in a file. Useful for making partial changes to an existing file.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | The path to the file to edit. | |
| new_string | Yes | The text to replace it with. This will be inserted exactly as provided. | |
| old_string | Yes | The exact text to replace. IMPORTANT: This must match the file contents exactly, including all indentation, newlines, and whitespace. If you previously read the file with line numbers, you must strip them before matching. | |
| replace_all | No | Whether to replace all occurrences. Set to `true` to replace every instance instead. IMPORTANT: If `false` or omitted, the edit will fail if `old_string` appears more than once in the file. Defaults to `false` if not specified. |