Skip to main content
Glama

search_code

Read-only

Find lines matching a case-insensitive Python regex across tracked and untracked source files, skipping venv, node_modules, and binaries; returns numbered path:line hits.

Instructions

Find lines matching a case-insensitive Python regular expression in this Guaardvark install's own source files: tracked files and untracked ones git does not ignore, skipping venv, node_modules, dist, build, logs and pycache folders, binary files, symlinks, and .env or credential files. Returns the total, then up to 100 numbered 'path:line' hits with the line text (long lines cut at 300 characters). Matching is one line at a time. 'No matches found' is a normal result; an invalid pattern, or an absolute, ~ or '..' glob, is an error. A pattern that backtracks badly (nested repeats such as '(\w+\s*)+') is stopped with an error once one line takes over 1 s or the whole search over 20 s. Use it for exact names and patterns; search_codebase asks by meaning when the zvec_grep plugin is connected; read_code opens a hit that is UTF-8 text.

Input Schema

NameRequiredDescriptionDefault
patternYesPython regular expression, matched case-insensitively against one line at a time, e.g. 'def\s+load_config' or 'Button.*onClick'. Escape ( [ . and the like to match them literally.
file_globNoWhich files to search, relative to the checkout root, e.g. 'backend/**/*.py', 'frontend/**/*.{js,jsx}', '*.py' or 'backend/utils'. A glob without '/' matches file names in any folder ('*.py' is every Python file, as with ripgrep -g); a folder name with no wildcard searches every file under it. '**/' spans zero or more folders, '*' and '?' stay within one folder name, and {a,b} groups expand anywhere; [abc] classes are not supported. Default '**/*.{py,jsx,js,tsx,ts}'.**/*.{py,jsx,js,tsx,ts}

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / file_glob / description
      Previous value: -"Glob pattern for files to search (default: '**/*.{py,jsx,js,tsx,ts}')"New value: +"Which files to search, relative to the checkout root, e.g. 'backend/**/*.py', 'frontend/**/*.{js,jsx}', '*.py' or 'backend/utils'. A glob without '/' matches file names in any folder ('*.py' is every Python file, as with ripgrep -g); a folder name with no wildcard searches every file under it. '**/' spans zero or more folders, '*' and '?' stay within one folder name, and {a,b} groups expand anywhere; [abc] classes are not supported. Default '**/*.{py,jsx,js,tsx,ts}'."
    • changedInput schema / properties / pattern / description
      Previous value: -"Text or regex pattern to search for (e.g., 'handleClick', 'Button.*onClick')"New value: +"Python regular expression, matched case-insensitively against one line at a time, e.g. 'def\\s+load_config' or 'Button.*onClick'. Escape ( [ . and the like to match them literally."
  2. First observedv2.9.0

TDQS

A4.8/5.0
Behavior5/5

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

With only readOnlyHint=true in annotations, the description carries the rest and does so richly: excluded directories (venv, node_modules, dist, build, logs, __pycache__), binaries, symlinks, and .env/credential files; the 100-hit cap and 300-char line truncation; that 'No matches found' is normal while invalid patterns/globs are errors; and the 1s-per-line / 20s-overall backtracking cutoff. This is far beyond what the annotation provides.

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

Conciseness4/5

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

It front-loads what is searched and what is skipped, then the return shape, then error cases, then sibling routing. It is dense and long but nearly every clause carries operational information; a small amount of the glob detail overlaps the schema.

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?

No output schema exists, so the description must explain return values, and it does: total count plus up to 100 numbered 'path:line' hits with truncated line text. Combined with error and timeout behavior, an agent has everything needed to call and interpret results.

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%, so the schema already documents both parameters, giving a baseline of 3. The description goes further by disclosing glob validation semantics not in the schema — an absolute, ~ or '..' glob is an error — and reinforcing case-insensitive, one-line-at-a-time matching, which is a genuine value-add.

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?

States a specific verb (find) and resource (lines matching a regex in this install's own source files), scoping it precisely to tracked plus untracked non-ignored files. It names the sibling tools it is not (search_codebase for meaning, read_code for opening hits), so an agent can route correctly without opening another schema.

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?

Explicitly says to use this for exact names and patterns, that search_codebase is the by-meaning alternative when the zvec_grep plugin is connected, and that read_code opens a hit. This is a clear when-to-use plus named-alternatives statement.

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