Skip to main content
Glama

find_replace

Search and replace text across files in a directory tree, with dry-run preview by default and optional regex support.

Instructions

Grep-equivalent: find text across files with optional replacement. Search and replace text across files in a directory tree.

Defaults to dry_run=true so you can preview the diff before committing. Set dry_run=false to write changes.

When the [edits].show_write_diff config flag is on (the default), the response appends a per-file unified diff — in both preview and applied modes — for up to the first 20 changed files, with a "+N more file(s)" summary beyond that. Set show_write_diff=false to suppress it.

Skips binary files (detected via null-byte sniff of the first 8 KB). Skips files larger than max_file_bytes (50 MiB default). Honours .gitignore. Use 'glob' to limit which files to touch (e.g. ".go", "**/.md"); a glob with a literal directory prefix (e.g. "src/**/*.go") prunes sibling directories from the walk entirely. Files are processed in parallel; output is sorted by path.

For identifier refactors use rename_symbol (scope- and type-aware); find_replace is for plain-text edits (doc strings, license headers, hostnames, version strings, non-code files).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
globNoFile glob filter, e.g. '*.go' or '**/*.md'. Empty = all non-binary files.
pathNoDirectory to walk, or a single file. Absolute path, file:// URI, or workspace-relative path; defaults relative to the workspace root.
dry_runNoIf true (default), preview only; do not write files.
patternNoSearch pattern. Plain text by default; regex if use_regex=true.
dirty_okNoAllow editing files that have uncommitted changes in their git repository. Default false — the replacement is refused if any target file is dirty. Pass true to proceed anyway.
max_filesNoCap on number of files modified.
use_regexNo
replacementNoReplacement text. With regex, supports $1, $2 backreferences.
format_afterNoAfter writing changes, run the workspace formatter (gofumpt for Go, ruff format for Python) on each modified file. Formatter errors are reported as warnings and do not fail the call.
case_sensitiveNoDefault: smart-case (case-insensitive iff pattern is all lowercase).
max_file_bytesNoSkip files larger than this many bytes. Default 50 MiB.
Behavior5/5

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

With no annotations provided, the description carries the full burden and excels. It discloses dry-run default, diff output config flag and its limits, binary/large-file skipping, .gitignore honoring, glob pruning behavior, parallel processing, output sorting, dirty-file refusal, formatter behavior, and smart-case matching. This is exhaustive and beyond what annotations would typically provide.

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 front-loaded with the primary purpose and key default. Each subsequent sentence adds concrete operational detail—diff output limits, file skipping rules, glob semantics, parallel processing, and tool alternatives. There is no filler; every sentence earns its place given the tool's complexity.

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

Completeness5/5

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

Despite having no output schema, the description explains return behavior (per-file unified diff, '+N more file(s)' summary), safety (dry_run, dirty_ok), limitations (max_file_bytes, binary detection, .gitignore), and parameter interactions (glob pruning, max_files). For an 11-parameter tool with no output schema, this is remarkably complete and addresses all likely agent questions.

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 description coverage is 91%, so baseline is 3. The description adds meaningful context beyond the schema: it explains glob's directory-pruning effect when a literal directory prefix is used, clarifies that dry_run defaults to true for previewing, and describes parallel processing and output sorting. These nuances are not fully captured in the schema, pushing the score above baseline.

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 opens with 'Grep-equivalent: find text across files with optional replacement', a specific verb+resource statement. It further distinguishes from siblings by explicitly stating 'For identifier refactors use rename_symbol (scope- and type-aware); find_replace is for plain-text edits', making the tool's niche unmistakable.

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

Usage Guidelines5/5

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

The description provides explicit when-to-use guidance: it states the tool is for plain-text edits (doc strings, license headers, hostnames, version strings, non-code files) and directs identifier refactors to rename_symbol. It also clarifies the default dry_run behavior and config options, giving clear context for when to invoke this tool vs alternatives.

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/plumbkit/plumb'

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