Skip to main content
Glama

complex_find_replace

Perform context-aware advanced find and replace operations in files using regular expressions, enabling precise and efficient text modifications.

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 tool: routes to edit instance manager's replace command
    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 core replace command sent to the 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 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 EditCommand interface used internally, including 'replace' type for complex_find_replace
    export interface EditCommand { type: 'open' | 'close' | 'save' | 'edit' | 'find' | 'replace' | 'goto'; params: any; }
  • Classifies complex_find_replace as a complex operation in analyzeComplexity method
    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/edit-mcp'

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