mcp-text-editor
v1.2.2MCP Text Editor Server - Edit text files via MCP protocol
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
get_text_file_contents
Read text file contents from multiple files and line ranges. Returns file contents with hashes for concurrency control and line numbers for reference. The hashes are used to detect conflicts when editing the files. File paths must be absolute.
| Parameter | Type | Description |
|---|---|---|
files * | array | List of files and their line ranges to read |
encoding | string | Text encoding (default: 'utf-8') |
patch_text_file_contents
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.
| Parameter | Type | Description |
|---|---|---|
file_hash * | string | Hash of the file contents for concurrency control. |
file_path * | string | Path to the text file. File path must be absolute. |
patches * | array | List of patches to apply |
encoding | string | Text encoding (default: 'utf-8') |
create_text_file
Create a new text file with given content. The file must not exist already.
| Parameter | Type | Description |
|---|---|---|
contents * | string | Content to write to the file |
file_path * | string | Path to the text file. File path must be absolute. |
encoding | string | Text encoding (default: 'utf-8') |
append_text_file_contents
Append content to an existing text file. The file must exist.
| Parameter | Type | Description |
|---|---|---|
contents * | string | Content to append to the file |
file_hash * | string | 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 * | string | Path to the text file. File path must be absolute. |
encoding | string | Text encoding (default: 'utf-8') |
delete_text_file_contents
Delete specified content ranges from a text file. The file must exist. File paths must be absolute. You need to provide the file_hash comes from get_text_file_contents.
| Parameter | Type | Description |
|---|---|---|
file_hash * | string | 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 * | string | Path to the text file. File path must be absolute. |
ranges * | array | List of line ranges to delete |
encoding | string | Text encoding (default: 'utf-8') |
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.
| Parameter | Type | Description |
|---|---|---|
contents * | string | Content to insert |
file_hash * | string | 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 * | string | Path to the text file. File path must be absolute. |
after | integer | Line number after which to insert content (mutually exclusive with 'before') |
before | integer | Line number before which to insert content (mutually exclusive with 'after') |
encoding | string | Text encoding (default: 'utf-8') |