Skip to main content
Glama
joutvhu

Search Code MCP

by joutvhu

replace

Refactor code using AST, regex, or text patterns, preview unified diffs by default, then apply changes safely to files.

Instructions

Structural code refactoring and replacement engine. Supports AST rewrite or Regex/Text replacement. By default, runs in dryRun mode producing a unified diff preview to ensure safe operations before writing changes to disk.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNoDirectory or file to perform replacement in (default: '.').
typeNoReplacement engine: 'ast' (default structural rewrite), 'regex', 'text'ast
queryYesTarget search pattern to replace (AST pattern or regex)
dryRunNoIf true (default), outputs unified diff preview without modifying files on disk
fileTypeNoFile type filter
languageNoProgramming language for AST mode (auto-detected if omitted)
noIgnoreNoWhether to search inside gitignored files
filePatternNoGlob pattern to filter files
replacementYesReplacement string or AST rewrite pattern
excludePatternNoGlob pattern to exclude
maxReplacementsNoSafety guardrail: maximum number of matches to replace (default: 50)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.5/5.0
Behavior3/5

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

With no annotations, the description carries the full behavioral burden. It usefully surfaces that dryRun defaults to true and returns a diff preview before touching disk, but this largely restates the dryRun schema entry, and it says nothing about irreversibility when dryRun=false, permission needs, or failure behavior on zero matches.

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

Conciseness5/5

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

Three tight sentences with zero filler, front-loaded with the tool's identity and followed immediately by the modes and the safety default. Every sentence earns its place.

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?

For an 11-parameter mutation tool with no annotations and no output schema, the description covers the core purpose and the critical dryRun safety default but omits guidance on mode selection, filter parameters, and the maxReplacements guardrail visible only in the schema. Adequate as a minimum viable definition, not fully complete.

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 every parameter is already documented in the schema, including the dryRun default and the ast/regex/text enum. The description only echoes the engine-type distinction and adds no format, syntax, or interaction detail beyond the schema, so the baseline 3 applies.

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

Purpose4/5

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

The description names a specific verb and resource ('Structural code refactoring and replacement engine') and enumerates the modes (AST rewrite vs Regex/Text), which clearly separates it from read-only siblings like search and count. It stops short of explicitly naming an alternative tool or contrasting its scope with them.

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

Usage Guidelines3/5

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

Usage is implied rather than stated: the dryRun/default-preview sentence hints at a preview-then-write workflow, but there is no explicit 'use this when...' or 'prefer X instead' guidance, and nothing tells the agent when to pick AST versus regex versus text mode.

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

Deploy Server

Other Tools