Skip to main content
Glama

git_grep

Read-onlyIdempotent

Search permitted tracked files or a specific commit for literal or regex patterns, returning matches while enforcing repository path deny policies.

Instructions

Search permitted tracked working files or a commit; literal patterns by default. Omit repo_path to use the configured repository. Results and operations are restricted according to project policy.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "pattern": "<pattern>"
    },
    "name": "git_grep"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathsNo
regexNo
patternYes
revisionNo
max_countNo
repo_pathNoOptional repository root. Omit to use the server's fixed repository. An explicit path must identify that same repository.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2026.10.19

TDQS

B3.4/5.0
Behavior3/5

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

Annotations already declare readOnly, idempotent, non-destructive, closed-world, so the safety profile is carried. The description usefully adds that results are constrained by project policy ('permitted', 'restricted'), which explains truncated or missing results. It does not disclose result shape (match lines, line numbers?) or truncation behavior tied to max_count.

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?

Three short sentences, front-loaded with the core action before the default-path and policy caveats. Little waste, though the final policy sentence is somewhat vague filler compared to the concrete first two.

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

Completeness3/5

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

With six parameters, no output schema, and low schema coverage, the description should say more about what a match result looks like and what max_count/paths do. As written it covers the main mode switch (working tree vs commit) but leaves an agent guessing on scoping and result shape.

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 only 17% (only repo_path documented), so the description must compensate. It does explain pattern literalness, implies regex via 'literal patterns by default', ties revision to searching a commit, and restates the repo_path default, but leaves 'paths' and 'max_count' (default 1000) entirely unaddressed.

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?

States a specific verb and resource: search (grep) tracked working files or a commit, with literal patterns by default. That is enough to tell it apart from mutation siblings like git_add or git_commit, though it does not explicitly differentiate against read-oriented siblings such as git_show or git_diff.

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?

Usage is implied rather than stated: 'or a commit' hints that revision selects history search versus working tree, and 'Omit repo_path to use the configured repository' gives a default. There is no explicit when-to-use/when-not guidance and no named alternative among the many git_* siblings.

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