Skip to main content
Glama

complex_find_replace

Perform context-aware find and replace operations in files using regular expressions and custom options, enabling precise text modifications and edits on the Edit-MCP server.

Instructions

Perform advanced find and replace operations with context awareness

Input Schema

NameRequiredDescriptionDefault
optionsNoAdditional options for the find and replace operation
pathYesPath to the file to perform find and replace on
patternYesRegular expression pattern to search for
replacementYesReplacement text

Input Schema (JSON Schema)

{ "properties": { "options": { "description": "Additional options for the find and replace operation", "type": "object" }, "path": { "description": "Path to the file to perform find and replace on", "type": "string" }, "pattern": { "description": "Regular expression pattern to search for", "type": "string" }, "replacement": { "description": "Replacement text", "type": "string" } }, "required": [ "path", "pattern", "replacement" ], "type": "object" }

Implementation Reference

  • Handler for 'complex_find_replace' operation: creates an edit session and executes a 'replace' command on the EditInstanceManager.
    case 'complex_find_replace': return this.editInstanceManager.executeEditCommand(sessionId, { type: 'replace', params: { pattern: operation.params.pattern, replacement: operation.params.replacement, options: operation.params.options } });
  • Executes the 'replace' EditCommand by sending a formatted command to the spawned Edit process instance.
    case 'replace': result = await instance.executeCommand(`replace ${command.params.pattern} ${command.params.replacement}`); return { success: true, message: result };
  • src/index.ts:272-303 (registration)
    Registers the 'complex_find_replace' tool with the MCP server, including its input schema and annotations.
    mcpServer.registerTool({ name: 'complex_find_replace', description: 'Perform advanced find and replace operations with context awareness', inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'Path to the file to perform find and replace on' }, pattern: { type: 'string', description: 'Regular expression pattern to search for' }, replacement: { type: 'string', description: 'Replacement text' }, options: { type: 'object', description: 'Additional options for the find and replace operation' } }, required: ['path', 'pattern', 'replacement'] }, annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false } });
  • Defines the input schema for the 'complex_find_replace' tool.
    inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'Path to the file to perform find and replace on' }, pattern: { type: 'string', description: 'Regular expression pattern to search for' }, replacement: { type: 'string', description: 'Replacement text' }, options: { type: 'object', description: 'Additional options for the find and replace operation' } }, required: ['path', 'pattern', 'replacement'] },
  • Classifies 'complex_find_replace' as a complex operation in the router's complexity analysis.
    const complexOperations = [ 'interactive_edit_session', 'format_code', 'complex_find_replace', 'merge_conflicts_resolution', 'bulk_edit_operation', 'edit_with_context_awareness' ];

Other Tools

Related Tools

Latest Blog Posts

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/mixelpixx/microsoft-edit-mcp'

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