Edit File
editReplace exact literal strings in files sequentially. Target first occurrence per edit using oldText context. Preview with dryRun to verify changes before writing.
Instructions
Apply sequential literal string replacements to a file (first occurrence per edit). oldText must match exactly — include 3–5 lines of context for unique targeting. Use dryRun:true to preview.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path to file or directory. | |
| edits | Yes | List of replacements to apply sequentially. Each edit replaces the first occurrence of oldText. | |
| dryRun | No | Preview edits without writing. Check `unmatchedEdits` in response. | |
| ignoreWhitespace | No | Treat all whitespace sequences as equivalent when matching oldText. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | ||
| path | No | ||
| appliedEdits | No | ||
| linesAdded | No | Lines added | |
| linesRemoved | No | Lines removed | |
| lineRange | No | Line range modified [start, end] (1-based) | |
| unmatchedEdits | No | Edits that could not be applied | |
| diff | No | Unified diff of changes (dryRun) |