Skip to main content
Glama

regexreplace

Perform regex find-and-replace operations across files while preserving original encoding. Supports single files or directories with glob filtering, capture group replacement, and dry-run previews.

Instructions

Performs regex find-and-replace across files. Encoding-aware: preserves original file encoding. Supports single file or recursive directory mode with glob filtering. Supports capture group replacement ($1, $2, ${name}). Skips binary files. Use dry_run=true to preview changes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
patternYesRegular expression pattern to search for
replacementYesReplacement string. Supports $1, $2 capture groups
pathYesFile or directory to process (absolute path)
globNoGlob pattern to filter files when path is a directory (e.g. *.go). Only used when path is a directory
ignore_caseNoCase insensitive search (default false)
dry_runNoPreview changes without modifying files (default false)
max_filesNoMaximum number of files to process in directory mode. Default: 100
Behavior4/5

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

No annotations provided, so description carries full burden. Discloses encoding preservation, binary file skipping, recursive vs single-file modes, and dry_run capability. These are critical behavioral traits for a destructive file operation. Minor gap: doesn't specify atomicity, backup creation, or return value format.

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?

Five efficient sentences with zero waste. Front-loaded with core function ('Performs regex find-and-replace'), followed by critical behavioral constraints (encoding, binary skip), capabilities (directory mode, capture groups), and safety (dry_run). No redundant or filler text.

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?

Given 7 parameters, destructive mutation semantics, and lack of output schema, description adequately covers operational behavior (encoding, recursion, binary handling, preview). Minor gap: without output schema, description should ideally characterize return values (e.g., modified file list, replacement counts), but operational coverage is strong.

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 has 100% description coverage, establishing baseline 3. Description adds value by documenting ${name} syntax for named capture groups (not mentioned in schema's $1, $2 description) and contextualizing glob as 'filtering'. Exceeds baseline by adding syntactic details and usage context.

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?

Description opens with specific verb phrase 'Performs regex find-and-replace' and resource 'files'. The 'regex' qualifier distinguishes it from sibling `edit` (likely interactive/single-file) and `write` (create new), while 'across files' distinguishes from `grep` (read-only search). Clear scope definition.

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?

Provides one explicit usage pattern ('Use dry_run=true to preview changes'), which hints at a safety workflow. However, lacks explicit comparison to siblings like `patch` (diff-based), `edit` (manual editing), or `write` (overwrite) to guide selection. No 'when not to use' guidance.

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/knewstimek/agent-tool'

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