Skip to main content
Glama

search_text

Locate matching lines across a file tree using regex or literal text, then list files, count matches, or replace content after previewing a dry-run diff.

Instructions

Grep a whole tree: regex (or literal) across files, returning only matching lines with file:line and optional context. Skips .git/node_modules/build dirs and binaries, honours .gitignore. Use files_only=true to just locate files, count_only=true for tallies. Set replace= to rewrite every match (dry_run=true first shows a diff).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
globNoOnly these paths, as globs: ["*.ts","src/**/*.js"]. A pattern without "/" matches the basename at any depth.
pathNoFile or directory to search. Default: server cwd.
wordNoMatch whole words only.
contextNoLines of context on both sides of each match.
dry_runNoWith replace: show the diff without writing.
excludeNoGlobs to skip.
literalNoTreat pattern as plain text, not a regex.
patternYesRegex to search for (JS syntax), or a literal string when literal=true.
replaceNoReplacement text ($1 backrefs work). Rewrites the files unless dry_run=true.
max_bytesNoByte cap on the returned text. Lower it to save tokens.
max_depthNoRecursion depth. Default 24.
max_filesNoStop after this many files with matches. Default 100.
multilineNoLet the pattern span lines (. matches newline).
skip_dirsNoDirectory names not to enter (replaces the default list).
count_onlyNoReturn just a match count per file.
files_onlyNoReturn just the list of matching file paths — the cheapest mode.
ignore_caseNoCase-insensitive match.
max_resultsNoStop after this many matching lines. Default 200.
show_hiddenNoSearch dotfiles too.
max_file_bytesNoSkip files bigger than this. Default 2000000.
respect_gitignoreNoHonour .gitignore. Default true.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses the default exclusions (.git/node_modules/build, binaries), .gitignore honouring, and — critically — that replace rewrites files on disk while dry_run only shows a diff. It stops short of stating permission requirements or interaction with respect_gitignore/skip_dirs overrides.

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 dense sentences, zero filler, and the core capability plus the two most decision-relevant modes are front-loaded before the riskier replace/dry_run note.

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 21-parameter tool with no output schema, the description supplies the essentials an agent needs: what it searches, what it skips, what the output contains, and the one dangerous mode. It is reasonably complete, though it could say more about the interaction between user-supplied skip_dirs/glob/exclude and the built-in defaults.

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 the schema already documents all 21 parameters thoroughly. The description restates a handful of them (files_only, count_only, replace, dry_run) in workflow terms, which is modest added value, but most parameter meaning lives in the schema and the description adds no syntax or default detail beyond it.

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?

Names a specific verb and resource ("Grep a whole tree") and describes the output shape ("matching lines with file:line and optional context"), which is concrete and unambiguous. It never differentiates itself from the sibling search_files, so an agent must still infer the routing between the two.

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?

Gives explicit mode-selection guidance: "Use files_only=true to just locate files, count_only=true for tallies" and the replace/dry_run workflow. This covers when to pick each mode, but offers no guidance on when to prefer this tool over siblings like search_files or shell_exec, and no exclusions.

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