Skip to main content
Glama

Filesystem MCP Server

edit_file

Apply text replacements to a file, generate a unified diff of changes, and update the file atomically. Specify file path and edit operations with 'oldText' and 'newText' keys.

Instructions

Apply multiple text replacements to a file and return a unified diff.

Args: path (str): File path to edit (absolute or relative to allowed directories) edits (List[Dict[str, str]]): List of edit operations, each with 'oldText' and 'newText' keys

Returns: str: Unified diff showing changes made, or error message if failed

Note: - Path must be within allowed directory roots - File must be a UTF-8 text file - Edits are applied sequentially in the order provided - Each 'oldText' must match exactly (first occurrence is replaced) - Returns unified diff format showing before/after changes - File is atomically updated using temporary file - If no changes made, returns 'No changes made.'

Input Schema

NameRequiredDescriptionDefault
editsYes
pathYes

Input Schema (JSON Schema)

{ "properties": { "edits": { "items": { "additionalProperties": { "type": "string" }, "type": "object" }, "title": "Edits", "type": "array" }, "path": { "title": "Path", "type": "string" } }, "required": [ "path", "edits" ], "type": "object" }
Install Server

Other Tools from Filesystem MCP Server

Related Tools

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/Preston-Harrison/fs-mcp-py'

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