Skip to main content
Glama

mcp-text-editor

by tumf
MIT License
145
  • Apple
  • Linux

patch_text_file_contents

Modify text files by applying patches with hash-based validation for concurrency control. Ensure file integrity by using hash values to verify content changes, enabling precise updates to specific line ranges.

Instructions

Apply patches to text files with hash-based validation for concurrency control.you need to use get_text_file_contents tool to get the file hash and range hash every time before using this tool. you can use append_text_file_contents tool to append text contents to the file without range hash, start and end. you can use insert_text_file_contents tool to insert text contents to the file without range hash, start and end.

Input Schema

NameRequiredDescriptionDefault
encodingNoText encoding (default: 'utf-8')utf-8
file_hashYesHash of the file contents for concurrency control.
file_pathYesPath to the text file. File path must be absolute.
patchesYesList of patches to apply

Input Schema (JSON Schema)

{ "properties": { "encoding": { "default": "utf-8", "description": "Text encoding (default: 'utf-8')", "type": "string" }, "file_hash": { "description": "Hash of the file contents for concurrency control.", "type": "string" }, "file_path": { "description": "Path to the text file. File path must be absolute.", "type": "string" }, "patches": { "description": "List of patches to apply", "items": { "properties": { "contents": { "description": "New content to replace the range with", "type": "string" }, "end": { "description": "Ending line number (null for end of file).it should match the range hash.", "type": "integer" }, "range_hash": { "description": "Hash of the content being replaced. it should get from get_text_file_contents tool with the same start and end.", "type": "string" }, "start": { "description": "Starting line number (1-based).it should match the range hash.", "type": "integer" } }, "required": [ "start", "end", "contents", "range_hash" ], "type": "object" }, "type": "array" } }, "required": [ "file_path", "file_hash", "patches" ], "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