Skip to main content
Glama

MCP File Editor Server

by pwilkin

replace_in_file

Search and replace all occurrences of a regex pattern with a target string in a file, enabling precise content modifications with optional single-match enforcement.

Instructions

Replace all occurrences of a regex pattern with a target string in a file.

Input Schema

NameRequiredDescriptionDefault
file_pathYesAbsolute path to the file
multipleNoAllow multiple replacements. If false, fails if multiple matches found.
regex_sourceYesRegular expression pattern to search for
targetYesString to replace matches with

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "file_path": { "description": "Absolute path to the file", "type": "string" }, "multiple": { "description": "Allow multiple replacements. If false, fails if multiple matches found.", "type": "boolean" }, "regex_source": { "description": "Regular expression pattern to search for", "type": "string" }, "target": { "description": "String to replace matches with", "type": "string" } }, "required": [ "file_path", "regex_source", "target" ], "type": "object" }

Other Tools from MCP File Editor 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/pwilkin/mcp-file-edit'

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