edit_file
Make line-based edits to text files by replacing specific line sequences with new content. Returns a git-style diff showing all changes made to the file.
Instructions
Make line-based edits to a text file. Provide original lines and their replacements. Returns a git-style diff showing the changes made. Each edit replaces exact line sequences with new content.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | The path to the file to edit | |
| edits | Yes | Array of edit operations to apply |
Input Schema (JSON Schema)
{
"properties": {
"edits": {
"description": "Array of edit operations to apply",
"items": {
"properties": {
"newText": {
"description": "The text to replace it with",
"type": "string"
},
"oldText": {
"description": "The exact text to search for (can be multiple lines)",
"type": "string"
}
},
"required": [
"oldText",
"newText"
],
"type": "object"
},
"type": "array"
},
"path": {
"description": "The path to the file to edit",
"type": "string"
}
},
"required": [
"path",
"edits"
],
"type": "object"
}