edit_file
Modify text files by replacing exact line sequences with new content, returning a git-style diff. Works within predefined directories for secure, controlled file edits.
Instructions
Make line-based edits to a text file. Each edit replaces exact line sequences with new content. Returns a git-style diff showing the changes made. Only works within allowed directories.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
dryRun | No | Preview changes using git-style diff format | |
edits | Yes | List of edit operations to perform | |
path | Yes | Path to the file to edit |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"dryRun": {
"default": false,
"description": "Preview changes using git-style diff format",
"type": "boolean"
},
"edits": {
"description": "List of edit operations to perform",
"items": {
"additionalProperties": false,
"properties": {
"newText": {
"description": "Text to replace with",
"type": "string"
},
"oldText": {
"description": "Text to search for - must match exactly",
"type": "string"
}
},
"required": [
"oldText",
"newText"
],
"type": "object"
},
"type": "array"
},
"path": {
"description": "Path to the file to edit",
"type": "string"
}
},
"required": [
"path",
"edits"
],
"type": "object"
}