Skip to main content
Glama

mcp-text-editor

by tumf
MIT License
145
  • Apple
  • Linux

insert_text_file_contents

Insert content at specific lines in a text file while ensuring concurrency control with hash-based validation. Ideal for precise edits in line-oriented text files.

Instructions

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" }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/tumf/mcp-text-editor'

If you have feedback or need assistance with the MCP directory API, please join our Discord server