mcp-text-editor

by tumf
MIT License
25
  • Apple
  • Linux

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

NameRequiredDescriptionDefault
afterNoLine number after which to insert content (mutually exclusive with 'before')
beforeNoLine number before which to insert content (mutually exclusive with 'after')
contentsYesContent to insert
encodingNoText encoding (default: 'utf-8')utf-8
file_hashYesHash of the file contents for concurrency control. it should be matched with the file_hash when get_text_file_contents is called.
file_pathYesPath 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" }