edit_file_content
Modify text files by replacing specified content with new text, preserving indentation and generating a git-style diff. Use it to preview changes or apply edits directly to files in the workspace.
Instructions
Make line-based edits to a text file in the workspace filesystem. Each edit attempts to replace an exact match of 'oldText' with 'newText'. If no exact match is found, it attempts a line-by-line match ignoring leading/trailing whitespace. Indentation of the first line is preserved, and relative indentation of subsequent lines is attempted. Returns a git-style diff showing the changes made (or previewed if dryRun is true).
Input Schema
Name | Required | Description | Default |
---|---|---|---|
dryRun | No | If true, preview changes using git-style diff format without saving. | |
edits | Yes | An array of edit operations to apply sequentially. | |
path | Yes | The path of the file to edit (relative to the workspace directory). |