update_file
Modify specific text within a file using search and replace operations. Supports regex, selective updates, and optional backups for precise file editing.
Instructions
Update specific parts of a file using search and replace
Input Schema
Name | Required | Description | Default |
---|---|---|---|
backup | No | Create backup before updating (.bak extension) | |
path | Yes | File path relative to working directory | |
updates | Yes | Array of search/replace operations |
Input Schema (JSON Schema)
{
"properties": {
"backup": {
"default": true,
"description": "Create backup before updating (.bak extension)",
"type": "boolean"
},
"path": {
"description": "File path relative to working directory",
"type": "string"
},
"updates": {
"description": "Array of search/replace operations",
"items": {
"properties": {
"all": {
"default": true,
"description": "Replace all occurrences",
"type": "boolean"
},
"regex": {
"default": false,
"description": "Use regex for search",
"type": "boolean"
},
"replace": {
"description": "Text to replace with",
"type": "string"
},
"search": {
"description": "Text to search for (exact match)",
"type": "string"
}
},
"required": [
"search",
"replace"
],
"type": "object"
},
"type": "array"
}
},
"required": [
"path",
"updates"
],
"type": "object"
}