mcp-text-editor
Servidor editor de texto MCP
Un servidor de Protocolo de Contexto de Modelo (MCP) que ofrece funciones de edición de archivos de texto orientados a líneas mediante una API estandarizada. Optimizado para herramientas LLM con acceso parcial eficiente a archivos para minimizar el uso de tokens.
Inicio rápido para usuarios de Claude.app
Para utilizar este editor con Claude.app, agregue la siguiente configuración a su mensaje:
code ~/Library/Application\ Support/Claude/claude_desktop_config.json{
"mcpServers": {
"text-editor": {
"command": "uvx",
"args": [
"mcp-text-editor"
]
}
}
}o con docker:
{
"mcpServers": {
"text-editor": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"--mount",
"type=bind,src=/some/path/src,dst=/some/path/dst",
"mcp/text-editor"
]
}
}
}Related MCP server: RBT Document Editor
Descripción general
El Servidor del Editor de Texto MCP está diseñado para facilitar operaciones seguras y eficientes con archivos de texto basados en líneas en una arquitectura cliente-servidor. Implementa el Protocolo de Contexto de Modelo, lo que garantiza una edición de archivos fiable con una robusta detección y resolución de conflictos. Su enfoque orientado a líneas lo hace ideal para aplicaciones que requieren acceso sincronizado a archivos, como herramientas de edición colaborativa, sistemas de procesamiento de texto automatizado o cualquier escenario donde varios procesos necesiten modificar archivos de texto de forma segura. La capacidad de acceso parcial a archivos es especialmente valiosa para herramientas basadas en LLM, ya que ayuda a reducir el consumo de tokens al cargar solo las partes necesarias de los archivos.
Beneficios clave
Operaciones de edición basadas en líneas
Acceso parcial a archivos con uso eficiente de tokens y especificaciones de rango de línea
Optimizado para la integración de herramientas LLM
Edición concurrente segura con validación basada en hash
Operaciones atómicas de múltiples archivos
Manejo robusto de errores con tipos de errores personalizados
Soporte de codificación completo (utf-8, shift_jis, latin1, etc.)
Características
Edición y lectura de archivos de texto orientados a líneas
Acceso parcial inteligente a archivos para minimizar el uso de tokens en aplicaciones LLM
Obtener el contenido del archivo de texto con la especificación del rango de líneas
Leer múltiples rangos de múltiples archivos en una sola operación
Aplicación de parches basada en líneas con manejo correcto de cambios de número de línea
Editar el contenido de archivos de texto con detección de conflictos
Soporte de codificación de caracteres flexible (utf-8, shift_jis, latin1, etc.)
Soporte para múltiples operaciones con archivos
Manejo adecuado de ediciones concurrentes con validación basada en hash
Procesamiento de archivos grandes con uso eficiente de la memoria
Requisitos
Python 3.11 o superior
Sistema operativo compatible con POSIX (Linux, macOS, etc.) o Windows
Suficiente espacio en disco para operaciones con archivos de texto
Permisos del sistema de archivos para operaciones de lectura y escritura
Instalar Python 3.11+
pyenv install 3.11.6
pyenv local 3.11.6Instalar uv (recomendado) o pip
curl -LsSf https://astral.sh/uv/install.sh | shCrear entorno virtual e instalar dependencias
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv pip install -e ".[dev]"Requisitos
Python 3.13+
Sistema operativo compatible con POSIX (Linux, macOS, etc.) o Windows
Permisos del sistema de archivos para operaciones de lectura y escritura
Instalación
Ejecutar a través de uvx
uvx mcp-text-editorInstalación mediante herrería
Para instalar Text Editor Server para Claude Desktop automáticamente a través de Smithery :
npx -y @smithery/cli install mcp-text-editor --client claudeInstalación manual
Instalar Python 3.13+
pyenv install 3.13.0
pyenv local 3.13.0Instalación de Docker
docker build --network=host -t mcp/text-editor .Instalar uv (recomendado) o pip
curl -LsSf https://astral.sh/uv/install.sh | shCrear entorno virtual e instalar dependencias
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv pip install -e ".[dev]"Uso
Iniciar el servidor:
python -m mcp_text_editorInicie el servidor con Docker:
docker run -i --rm --mount "type=bind,src=/some/path/src,dst=/some/path/dst" mcp/text-editorcon el inspector:
npx @modelcontextprotocol/inspector docker run -i --rm --mount "type=bind,src=/some/path/src,dst=/some/path/dst" mcp/text-editorHerramientas MCP
El servidor proporciona varias herramientas para la manipulación de archivos de texto:
obtener_el_contenido_del_archivo_de_texto
Obtenga el contenido de uno o más archivos de texto con especificación de rango de línea.
Solicitud de rango único:
{
"file_path": "path/to/file.txt",
"line_start": 1,
"line_end": 10,
"encoding": "utf-8" // Optional, defaults to utf-8
}Solicitud de rangos múltiples:
{
"files": [
{
"file_path": "file1.txt",
"ranges": [
{"start": 1, "end": 10},
{"start": 20, "end": 30}
],
"encoding": "shift_jis" // Optional, defaults to utf-8
},
{
"file_path": "file2.txt",
"ranges": [
{"start": 5, "end": 15}
]
}
]
}Parámetros:
file_path: Ruta al archivo de textoline_start/start: Número de línea desde el que comenzar (basado en 1)line_end/end: Número de línea donde finalizar (inclusive, nulo para el final del archivo)encoding: Codificación del archivo (predeterminado: "utf-8"). Especifique la codificación del archivo de texto (p. ej., "shift_jis", "latin1").
Respuesta de rango único:
{
"contents": "File contents",
"line_start": 1,
"line_end": 10,
"hash": "sha256-hash-of-contents",
"file_lines": 50,
"file_size": 1024
}Respuesta de rangos múltiples:
{
"file1.txt": [
{
"content": "Lines 1-10 content",
"start": 1,
"end": 10,
"hash": "sha256-hash-1",
"total_lines": 50,
"content_size": 512
},
{
"content": "Lines 20-30 content",
"start": 20,
"end": 30,
"hash": "sha256-hash-2",
"total_lines": 50,
"content_size": 512
}
],
"file2.txt": [
{
"content": "Lines 5-15 content",
"start": 5,
"end": 15,
"hash": "sha256-hash-3",
"total_lines": 30,
"content_size": 256
}
]
}contenido del archivo de texto del parche
Aplique parches a archivos de texto con gestión robusta de errores y detección de conflictos. Admite la edición de varios archivos en una sola operación.
Formato de solicitud:
{
"files": [
{
"file_path": "file1.txt",
"hash": "sha256-hash-from-get-contents",
"encoding": "utf-8", // Optional, defaults to utf-8
"patches": [
{
"start": 5,
"end": 8,
"range_hash": "sha256-hash-of-content-being-replaced",
"contents": "New content for lines 5-8\n"
},
{
"start": 15,
"end": null, // null means end of file
"range_hash": "sha256-hash-of-content-being-replaced",
"contents": "Content to append\n"
}
]
}
]
}Notas importantes:
Obtenga siempre el hash actual y range_hash usando get_text_file_contents antes de editar
Los parches se aplican de abajo a arriba para manejar correctamente los cambios de número de línea
Los parches no deben superponerse dentro del mismo archivo
Los números de línea se basan en 1
end: nullpara agregar contenido al final del archivoLa codificación del archivo debe coincidir con la codificación utilizada en get_text_file_contents
Respuesta de éxito:
{
"file1.txt": {
"result": "ok",
"hash": "sha256-hash-of-new-contents"
}
}Respuesta de error con sugerencias:
{
"file1.txt": {
"result": "error",
"reason": "Content hash mismatch",
"suggestion": "get", // Suggests using get_text_file_contents
"hint": "Please run get_text_file_contents first to get current content and hashes"
}
}"result": "error",
"reason": "Content hash mismatch - file was modified",
"hash": "current-hash",
"content": "Current file content"} }
### Common Usage Pattern
1. Get current content and hash:
```python
contents = await get_text_file_contents({
"files": [
{
"file_path": "file.txt",
"ranges": [{"start": 1, "end": null}] # Read entire file
}
]
})Editar el contenido del archivo:
result = await edit_text_file_contents({
"files": [
{
"path": "file.txt",
"hash": contents["file.txt"][0]["hash"],
"encoding": "utf-8", # Optional, defaults to "utf-8"
"patches": [
{
"line_start": 5,
"line_end": 8,
"contents": "New content\n"
}
]
}
]
})Manejar conflictos:
if result["file.txt"]["result"] == "error":
if "hash mismatch" in result["file.txt"]["reason"]:
# File was modified by another process
# Get new content and retry
passManejo de errores
El servidor maneja varios casos de error:
Archivo no encontrado
Errores de permisos
Desajustes de hash (detección de edición concurrente)
Rangos de parches no válidos
Parches superpuestos
Errores de codificación (cuando el archivo no se puede decodificar con la codificación especificada)
Número de línea fuera de límites
Consideraciones de seguridad
Validación de ruta de archivo: el servidor valida todas las rutas de archivo para evitar ataques de recorrido de directorio
Control de acceso: se deben configurar los permisos adecuados del sistema de archivos para restringir el acceso a los directorios autorizados
Validación de hash: todas las modificaciones de archivos se validan utilizando hashes SHA-256 para evitar condiciones de carrera
Sanitización de entrada: todas las entradas del usuario se desinfectan y validan adecuadamente
Manejo de errores: La información confidencial no se expone en los mensajes de error
Solución de problemas
Problemas comunes
Permiso denegado
Comprobar permisos de archivos y directorios
Asegúrese de que el proceso del servidor tenga el acceso de lectura y escritura necesario
Errores de hash de rango y desajuste de hash
El archivo fue modificado por otro proceso
El contenido que se está reemplazando ha cambiado
Ejecute get_text_file_contents para obtener hashes nuevos
Problemas de codificación
Verificar que la codificación del archivo coincida con la codificación especificada
Utilice utf-8 para archivos nuevos
Comprobar marcadores de lista de materiales en los archivos
Problemas de conexión
Verifique que el servidor esté en ejecución y sea accesible
Compruebe la configuración de la red y la configuración del firewall
Problemas de rendimiento
Considere usar rangos de líneas más pequeños para archivos grandes
Monitorear los recursos del sistema (memoria, espacio en disco)
Utilice la codificación adecuada para el tipo de archivo
Desarrollo
Configuración
Clonar el repositorio
Crear y activar un entorno virtual de Python
Instalar dependencias de desarrollo:
uv pip install -e ".[dev]"Ejecutar pruebas:
make all
Herramientas de calidad del código
Ruff para pelusa
Negro para formato de código
isort para la clasificación de importaciones
mypy para verificación de tipos
pytest-cov para la cobertura de pruebas
Pruebas
Las pruebas se encuentran en el directorio tests y se pueden ejecutar con pytest:
# Run all tests
pytest
# Run tests with coverage report
pytest --cov=mcp_text_editor --cov-report=term-missing
# Run specific test file
pytest tests/test_text_editor.py -vCobertura de prueba actual: 90%
Estructura del proyecto
mcp-text-editor/
├── mcp_text_editor/
│ ├── __init__.py
│ ├── __main__.py # Entry point
│ ├── models.py # Data models
│ ├── server.py # MCP Server implementation
│ ├── service.py # Core service logic
│ └── text_editor.py # Text editor functionality
├── tests/ # Test files
└── pyproject.toml # Project configurationLicencia
Instituto Tecnológico de Massachusetts (MIT)
Contribuyendo
Bifurcar el repositorio
Crear una rama de características
Realiza tus cambios
Ejecutar pruebas y controles de calidad del código
Enviar una solicitud de extracción
Sugerencias de tipo
Este proyecto utiliza sugerencias de tipo de Python en todo el código. Por favor, asegúrese de que todas las contribuciones las mantengan.
Manejo de errores
Todos los casos de error deben gestionarse adecuadamente y devolver mensajes de error significativos. El servidor nunca debe bloquearse debido a entradas o operaciones de archivo no válidas.
Pruebas
Las nuevas funciones deben incluir pruebas adecuadas. Intente mantener o mejorar la cobertura de pruebas actual.
Estilo de código
Todo el código debe estar formateado con Black y pasar el control de linting de Ruff. La ordenación de las importaciones debe ser gestionada por isort.
Available Tools
6 toolsappend_text_file_contentsB
Append content to an existing text file. The file must exist.
| Name | Required | Description | Default |
|---|---|---|---|
| contents | Yes | Content to append to the file | |
| 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. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the burden. It mentions the existence constraint but does not disclose side effects (mutation) or concurrency behavior despite file_hash being required. Some transparency, but gaps remain.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Extremely concise: two sentences with no wasted words. Front-loaded with the action and key constraint.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool modifies files and has a concurrency mechanism, the description omits details about return values, error conditions (e.g., hash mismatch, file not found), and side effects. Not complete for the complexity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so baseline is 3. The description adds no extra meaning beyond the schema; the file_hash parameter's role is mentioned in the schema but not elaborated in the description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('append') and the resource ('text file'), and distinguishes from siblings like 'create_text_file' and 'insert_text_file_contents'.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description only states 'The file must exist' but does not provide guidance on when to use this tool versus alternatives like 'create_text_file' or 'insert_text_file_contents'. No explicit when-to-use or when-not-to-use.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
create_text_fileA
Create a new text file with given content. The file must not exist already.
| Name | Required | Description | Default |
|---|---|---|---|
| contents | Yes | Content to write to the file | |
| encoding | No | Text encoding (default: 'utf-8') | utf-8 |
| file_path | Yes | Path to the text file. File path must be absolute. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so description must cover behavior. It discloses the creation action and file existence precondition, but lacks details on error handling (e.g., what happens if file exists), encoding usage, or side effects. It is adequate but not comprehensive.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
One short sentence plus a condition. No unnecessary words. The essential information is front-loaded, making it easy to parse.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with 3 parameters, no output schema, and no annotations, the description is minimal. It covers core purpose and a key precondition but omits details like error handling, encoding behavior, and any side effects (e.g., directory creation). It is adequate but could be more helpful.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, and the description adds minimal value beyond schema. It mentions 'given content' for contents (schema already says 'Content to write') and restates 'File path must be absolute' (already in schema). Encoding is not mentioned in description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description clearly states 'Create a new text file with given content', which is a specific verb and resource. It also adds the precondition that the file must not already exist, distinguishing it from siblings like append or patch.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly says 'The file must not exist already', guiding when to use (for new files) and implying when not to use (file already exists). However, it does not explicitly name alternatives or contrast with siblings.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
delete_text_file_contentsA
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.
| Name | Required | Description | Default |
|---|---|---|---|
| ranges | Yes | List of line ranges to delete | |
| 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. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the burden. It discloses that the file must exist, paths must be absolute, and that a hash is required for concurrency control. However, it doesn't disclose what happens if the hash mismatches, whether the operation is destructive/reversible, or what the return value is. The destructive nature is implied by 'Delete' but not elaborated.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is compact and front-loaded with the core action. The three sentences each add necessary context: what it does, the file existence/path requirement, and the hash prerequisite. It could be slightly more structured, but it's efficient and free of fluff.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a destructive mutation tool with no annotations and no output schema, the description should disclose more about failure modes, hash mismatch behavior, and whether the operation is reversible. It covers the key prerequisites but leaves the agent guessing about what happens on success or failure. The sibling tools and schema provide some context, but the description itself is incomplete for a destructive operation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents all parameters. The description adds the crucial context that file_hash comes from get_text_file_contents and that range_hash should match the one from get_text_file_contents. This adds value beyond the schema, but the schema already covers the basics, so a baseline 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific verb ('Delete'), a specific resource ('specified content ranges from a text file'), and the key precondition that the file must exist. It clearly distinguishes itself from siblings like append_text_file_contents, insert_text_file_contents, and patch_text_file_contents by focusing on deletion of ranges.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives clear context: the file must exist, paths must be absolute, and the file_hash must come from get_text_file_contents. It doesn't explicitly say when to use this tool versus alternatives, but the deletion-specific wording and the mention of get_text_file_contents as a prerequisite provide adequate usage guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_text_file_contentsA
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.
| Name | Required | Description | Default |
|---|---|---|---|
| files | Yes | List of files and their line ranges to read | |
| encoding | No | Text encoding (default: 'utf-8') | utf-8 |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are present, so the description carries the full burden. It discloses that the tool is read-only, returns hashes for concurrency control, includes line numbers for reference, and requires absolute paths. It does not cover failure modes or size limits, but the core behavioral traits are clearly explained.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three concise sentences, each earning its place: the first defines the operation, the second explains the return payload, and the third explains why hashes matter. There is no redundant phrasing or filler.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description, combined with the complete input schema, gives an agent enough to invoke the tool correctly. It describes the key return elements (hashes, line numbers) despite no output schema. Minor gaps around error behavior and exact return formatting keep it from a 5.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents every parameter, including the absolute path requirement and range semantics. The description adds no new parameter-level meaning beyond restating that paths must be absolute; the baseline 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with the specific verb 'Read' and resource 'text file contents', and immediately clarifies it handles multiple files and line ranges. This clearly distinguishes it from sibling editing/writing tools like append_text_file_contents and patch_text_file_contents.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description clearly indicates this is for reading files before editing, since it returns hashes 'used to detect conflicts when editing the files.' It provides clear usage context and indirectly positions itself as the read counterpart to the editing siblings, though it does not explicitly name alternatives or exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
insert_text_file_contentsA
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.
| 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. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full burden. It discloses hash-based concurrency control and the prerequisite of file_hash. However, it omits error behavior (e.g., out-of-range line, hash mismatch) and the fact that the file is modified in place.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two concise sentences, front-loaded with the core purpose and followed by an important prerequisite. No wasted words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers the main action and prerequisite, but lacks information on return value (no output schema) and error cases. For a tool with 6 parameters and no output schema, it is adequate but incomplete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, but the description adds value by explaining the concurrency control purpose of file_hash and the prerequisite relationship with get_text_file_contents. This goes beyond the schema's descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool inserts content before or after a specific line in a text file, using specific verbs and resources. It distinguishes from siblings like append_text_file_contents and patch_text_file_contents by specifying line-based insertion.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage by requiring the file_hash from get_text_file_contents, but does not explicitly state when to use this tool versus alternatives. No when-not or alternative guidance is provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
patch_text_file_contentsA
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.
| Name | Required | Description | Default |
|---|---|---|---|
| patches | Yes | List of patches to apply | |
| encoding | No | Text encoding (default: 'utf-8') | utf-8 |
| file_hash | Yes | Hash of the file contents for concurrency control. | |
| file_path | Yes | Path to the text file. File path must be absolute. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so description carries full burden. It mentions concurrency control via hashes but does not disclose error behavior (e.g., hash mismatch, partial patches) or permissions required. Could be more transparent about failure modes.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, dense paragraph with no superfluous words. It front-loads the main purpose and immediately gives prerequisite and alternative usage, making it efficient for agent parsing.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool has 4 parameters, no output schema, and complex nested patches, the description provides necessary context: prerequisite hash retrieval and alternative tools for simpler edits. Missing details on return value and errors, but sufficient for typical use cases.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%; each parameter has a description. The tool description adds context about hash usage and the need to fetch them from get_text_file_contents. However, it does not significantly enhance understanding beyond the schema beyond the prerequisite flow.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool applies patches to text files with hash-based concurrency control. It distinguishes itself from siblings by mentioning that append and insert tools do not require range hashes and start/end parameters.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Explicitly instructs the agent to use get_text_file_contents first to obtain file_hash and range_hash. Also provides alternatives (append, insert) for simpler operations, clearly delimiting when to use this tool and when not to.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
2 tool updates
v1.2.2- Changed
delete_text_file_contents2 fields changed- added
Input schema / properties / ranges / items / properties / end / nullableAdded value: +true - changed
Input schema / properties / ranges / items / properties / end / typePrevious value: -[ - "integer", - "null" -]New value: +"integer"
- Changed
get_text_file_contents2 fields changed- added
Input schema / properties / files / items / properties / ranges / items / properties / end / nullableAdded value: +true - changed
Input schema / properties / files / items / properties / ranges / items / properties / end / typePrevious value: -[ - "integer", - "null" -]New value: +"integer"
6 tool updates
v1.0.0- First observed
append_text_file_contents - First observed
create_text_file - First observed
delete_text_file_contents - First observed
get_text_file_contents - First observed
insert_text_file_contents - First observed
patch_text_file_contents
TDQS
Scored across 6 tools
Each tool targets a distinct operation: create, read, append, insert, delete range, and patch. However, patch_text_file_contents can be seen as overlapping with insert and delete since patches may subsume those operations, so agents might occasionally hesitate between them.
Most tools follow a verb_text_file_contents pattern, which is clear and consistent. The exception is create_text_file, which drops the _contents suffix and breaks the otherwise uniform convention.
Six tools is a well-scoped set for a text file editor. Each tool covers a necessary primitive operation without redundant or bloated additions.
The server provides create, read, append, insert, delete-range, and patch operations, covering the core editing lifecycle. A whole-file overwrite or file deletion operation is missing, but most workflows can be accomplished with the existing tools.
Maintenance
Related MCP Connectors
Use your Mac, Windows or Linux computer from ChatGPT, Claude or Codex: files, commands, documents.
Read and write your Fresh Jots notes from Claude, Cursor, and any MCP client.
Manage files and folders directly from your workspace. Read and write files, list directories, cre…
Persistent file storage for AI agents via MCP and curl. Upload, download, and version files.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables comprehensive file operations including reading, writing, searching, and editing files with advanced features like regex-based replacements, line-specific modifications, and directory-wide search capabilities. Provides 8 robust tools for safe file manipulation with content verification and detailed error handling.88 npm1MIT
- AlicenseAqualityDmaintenanceEnables efficient editing of RBT documents with structured operations that read and modify specific sections or blocks. Reduces LLM token consumption by 80-95% compared to full file operations through smart caching and partial document access.8MIT
- AlicenseNot gradedqualityDmaintenanceProvides hashline-based file editing using line-addressed edits and content hashes for integrity verification. It enables LLMs to perform precise file modifications while ensuring edits are rejected if the file content has changed since the last read.15 npm9MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server that provides line-oriented text file editing capabilities through a standardized API. Optimized for LLM tools with efficient partial file access to minimize token usage.MIT