Skip to main content
Glama

Filesystem MCP Server

update_file

Performs targeted search-and-replace operations on an existing file using {search, replace} blocks, optionally with regex. Ideal for localized updates without overwriting the entire file.

Instructions

Performs targeted search-and-replace operations within an existing file using an array of {search, replace} blocks. Preferred for smaller, localized changes. For large-scale updates or overwrites, consider using write_file. Accepts relative or absolute paths. File must exist. Supports optional useRegex (boolean, default false) and replaceAll (boolean, default false).

Input Schema

NameRequiredDescriptionDefault
blocksYesAn array of objects, each with a `search` (string) and `replace` (string) property.
pathYesThe path to the file to update. Can be relative or absolute (resolved like readFile). The file must exist.
replaceAllNoIf true, replace all occurrences matching the SEARCH criteria within the file. If false, only replace the first occurrence. Defaults to false.
useRegexNoIf true, treat the `search` field of each block as a JavaScript regular expression pattern. Defaults to false (exact string matching).

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "blocks": { "description": "An array of objects, each with a `search` (string) and `replace` (string) property.", "items": { "additionalProperties": false, "properties": { "replace": { "type": "string" }, "search": { "minLength": 1, "type": "string" } }, "required": [ "search", "replace" ], "type": "object" }, "minItems": 1, "type": "array" }, "path": { "description": "The path to the file to update. Can be relative or absolute (resolved like readFile). The file must exist.", "minLength": 1, "type": "string" }, "replaceAll": { "default": false, "description": "If true, replace all occurrences matching the SEARCH criteria within the file. If false, only replace the first occurrence. Defaults to false.", "type": "boolean" }, "useRegex": { "default": false, "description": "If true, treat the `search` field of each block as a JavaScript regular expression pattern. Defaults to false (exact string matching).", "type": "boolean" } }, "required": [ "path", "blocks" ], "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/cyanheads/filesystem-mcp-server'

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