Skip to main content
Glama

complex_find_replace

Destructive

Perform advanced find and replace operations in files using context-aware regular expressions to modify text patterns efficiently.

Instructions

Perform advanced find and replace operations with context awareness

Input Schema

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

Implementation Reference

  • src/index.ts:272-303 (registration)
    Registers the 'complex_find_replace' tool including its input schema, description, 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
      }
    });
  • Main handler for 'complex_find_replace' tool: creates an edit session and delegates to EditInstanceManager.executeEditCommand with a '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
        }
      });
  • Implements the replace operation (used by complex_find_replace) by executing a 'replace' command on the editor instance.
    case 'replace':
      result = await instance.executeCommand(`replace ${command.params.pattern} ${command.params.replacement}`);
      return { success: true, message: result };
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already indicate this is a destructive, non-idempotent, non-read-only operation, but the description adds value by specifying 'advanced' and 'context awareness', hinting at behavioral traits like intelligent pattern matching or contextual replacements. However, it doesn't detail what 'context awareness' entails or any rate limits/permissions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose. It avoids redundancy but could be slightly more informative without sacrificing brevity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (destructive, 4 parameters including nested objects) and lack of output schema, the description is minimally adequate. It hints at advanced features but doesn't fully explain the 'context awareness' or behavioral implications, leaving gaps for an AI agent to infer usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so parameters are well-documented in the schema. The description doesn't add meaning beyond the schema, such as explaining how 'context awareness' relates to the 'options' parameter or providing examples. Baseline 3 is appropriate since the schema carries the burden.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool performs 'advanced find and replace operations with context awareness', which gives a general purpose but lacks specificity about what makes it 'advanced' or 'context-aware'. It distinguishes from basic siblings like 'find_in_file' by implying more complexity, but doesn't clearly differentiate from 'smart_refactor' or 'interactive_edit_session'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives. The description mentions 'context awareness' but doesn't specify what contexts trigger its use over simpler tools like 'find_in_file' or more complex ones like 'smart_refactor'. No prerequisites or exclusions are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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