Skip to main content
Glama

apply_codemod

Destructive

Perform bulk regex find-and-replace across files. Preview changes with a dry run before applying to avoid accidental modifications.

Instructions

Bulk regex find-and-replace across files. Dry-run by default — first call shows preview, second call with dry_run=false applies. Use for mechanical changes like adding async/await, renaming patterns, updating imports across many files. Potentially destructive — can modify or delete code. Always preview with dry_run=true first. Returns JSON: { success, matchedFiles, changes: [{ file, matches }], applied }.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
patternYesRegex pattern to match (JavaScript regex syntax)
replacementYesReplacement string ($1, $2 for capture groups)
file_patternYesGlob pattern for files to scan (e.g. "tests/**/*.test.ts", "src/**/*.py")
dry_runNoPreview changes without writing (default: true). Set to false to apply.
confirm_largeNoRequired when >20 files affected. Acknowledges large-scale change.
filter_contentNoOnly process files containing this substring (narrows scope)
multilineNoEnable multiline mode (dot matches newlines, patterns span lines)
Behavior5/5

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

The description adds substantial behavioral context beyond annotations: it explains the two-step dry-run workflow, notes the tool is 'potentially destructive' (matching destructiveHint=true), and details the return format. No contradictions with annotations.

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?

The description is concise (4 sentences) and efficiently front-loads the core purpose. Each sentence adds essential information: purpose, workflow, usage examples, and warnings. No unnecessary words.

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

Completeness4/5

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

For a tool with 7 parameters and no output schema, the description covers the workflow, return format, and safety warnings. It mentions the confirm_large trigger. It could be more thorough on edge cases or explicit parameter constraints, but the essentials are present.

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

Parameters4/5

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

Schema coverage is 100% with clear descriptions. The description adds value by explaining the dry-run workflow and how parameters interact (e.g., confirm_large for >20 files). It integrates parameter usage into the overall process, enhancing understanding beyond the schema.

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

Purpose5/5

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

The description clearly states the tool's purpose: 'Bulk regex find-and-replace across files.' It specifies the verb (find-and-replace) and resource (files), and distinguishes it from siblings like apply_move and apply_rename by emphasizing regex and multiple files.

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

Usage Guidelines4/5

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

The description provides specific use cases ('mechanical changes like adding async/await, renaming patterns, updating imports') and instructs to 'Always preview with dry_run=true first.' It does not explicitly list when not to use or alternative tools, but the context is sufficient for appropriate use.

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/nikolai-vysotskyi/trace-mcp'

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