mavis_edit
Perform targeted text replacement in files. Replaces the first exact match by default, or all matches if requested; errors if no match found.
Instructions
Edit a file by replacing a specific string with new text. Default: replaces the FIRST occurrence only. If old_text is not found or matches multiple times and all_occurrences is false, returns an error. Use this for targeted edits; use mavis_write for full rewrites.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Subdirectory to resolve path against. | |
| path | Yes | Path relative to workspace root (or absolute within workspace). | |
| new_text | Yes | The replacement text. | |
| old_text | Yes | The exact text to find. Must match exactly (whitespace included). | |
| all_occurrences | No | Replace ALL occurrences. Default: false (only first). |