mcp-text-editor
by tumf
insert_text_file_contents
Insert content before or after a specific line in a text file. Uses hash-based validation for concurrency control. You need to provide the file_hash comes from get_text_file_contents.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
after | No | Line number after which to insert content (mutually exclusive with 'before') | |
before | No | Line number before which to insert content (mutually exclusive with 'after') | |
contents | Yes | Content to insert | |
encoding | No | Text encoding (default: 'utf-8') | utf-8 |
file_hash | Yes | Hash of the file contents for concurrency control. it should be matched with the file_hash when get_text_file_contents is called. | |
file_path | Yes | Path to the text file. File path must be absolute. |
Input Schema (JSON Schema)
{
"properties": {
"after": {
"description": "Line number after which to insert content (mutually exclusive with 'before')",
"type": "integer"
},
"before": {
"description": "Line number before which to insert content (mutually exclusive with 'after')",
"type": "integer"
},
"contents": {
"description": "Content to insert",
"type": "string"
},
"encoding": {
"default": "utf-8",
"description": "Text encoding (default: 'utf-8')",
"type": "string"
},
"file_hash": {
"description": "Hash of the file contents for concurrency control. it should be matched with the file_hash when get_text_file_contents is called.",
"type": "string"
},
"file_path": {
"description": "Path to the text file. File path must be absolute.",
"type": "string"
}
},
"required": [
"file_path",
"file_hash",
"contents"
],
"type": "object"
}