edit_file
Modify text files with line-based edits, automatic syntax validation for common formats, and optional dry-run previews that return git-style diffs to verify changes before applying.
Instructions
Make line-based edits to a text file with intelligent syntax validation. Each edit replaces exact line sequences with new content. Automatically validates syntax for JavaScript, TypeScript, JSON, YAML, XML/HTML files. Returns detailed error messages if validation fails to help fix syntax issues. Use dryRun=true to preview changes, skipValidation=true to bypass syntax checks. Returns a git-style diff showing the changes made. Only works within allowed directories.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| edits | Yes | ||
| dryRun | No | Preview changes using git-style diff format | |
| skipValidation | No | Skip syntax validation for the file type |