Skip to main content
Glama

Search code

search_code
Read-onlyIdempotent

Search tracked repository files for a literal string or POSIX regex, in the working tree or a specific commit. Skips binaries and policy-hidden paths.

Instructions

Search tracked files for a string or regex (git grep). Searches the working tree by default, or a specific commit with ref. Binary files and files hidden by the server's path policy are skipped. Prefer a literal query; set regex for POSIX extended regular expressions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
refNoCommit, branch or tag to search. Omit for the working tree.
queryYes
regexNoTreat `query` as a POSIX extended regex.
pathGlobsNoOnly search matching paths, e.g. `src/**/*.ts`. `*` does not cross `/`.
maxResultsNo
contextLinesNo
caseSensitiveNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
refYesResolved commit SHA, or null for the working tree.
matchesYes
truncatedYesTrue if there were more matches than were returned.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior4/5

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

Annotations cover safety (read-only, idempotent, non-destructive). The description adds useful behavioral context: binary files are skipped, and files hidden by the server's path policy are skipped. It omits result limits/pagination behavior, but the output schema likely covers returns.

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 tight sentences, front-loaded with purpose and scope, then edge-case behavior, then usage advice. No filler.

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 7-parameter search tool with an output schema, the description covers purpose, default scope, filtering skips, and regex guidance. It could do more on pathGlobs/maxResults/contextLines, but the schema and output schema shoulder much of that burden.

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 coverage is 43%, but the description adds meaning for `ref` and `regex` and establishes the default search target. Other parameters (pathGlobs, maxResults, contextLines, caseSensitive) are not explained in the description, leaving gaps relative to the low coverage.

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+resource (search tracked files) with the underlying mechanism (git grep) and scope (working tree vs. commit). This clearly distinguishes it from siblings like read_file, list_changed_files, and get_diff, which do not perform content search.

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?

Clarifies default behavior (working tree) vs. using `ref`, and gives a preference rule (literal query, set regex for POSIX ERE). It does not explicitly name alternative sibling tools or state when-not-to-use, so it falls short of a 5.

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

Deploy Server

Other Tools