Skip to main content
Glama

grep

Search file contents across repositories by text or regex, optionally filtered by file pattern, to locate code and documentation and return GitHub links with line numbers.

Instructions

Search file contents across repos. Returns GitHub links with line numbers.

Args: query: Text or regex pattern. repo: Repo name or 'all'. file_pattern: Filter like '.go' or '.yaml'.

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": {
      "query": "<query>"
    },
    "name": "grep"
  }
}

Input Schema

NameRequiredDescriptionDefault
repoNoall
queryYes
file_patternNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.3/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It does disclose a useful behavioral trait, the return shape (GitHub links with line numbers), which tells the agent output is line-located and link-based, but it says nothing about regex flavor, case sensitivity, result caps, pagination, or whether the caller's repo permissions scope the search.

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?

Two sentences plus a compact Args block; the one-line purpose and return format are front-loaded before the parameter detail. The Args section is slightly formulaic since the parameter names already appear in the schema, but it is short enough to earn its space.

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?

An output schema exists, so the return value does not need explaining and the description is adequate on that axis. For a cross-repo search tool, however, it omits how repos are addressed, whether results are truncated, and how the query is interpreted, which are the details an agent needs to call it correctly the first time.

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 0%, so the description must compensate, and it largely does: it identifies 'query' as text or a regex pattern, states 'repo' accepts a repo name or the literal 'all' (matching the default), and gives glob syntax for 'file_pattern'. Only the regex dialect and the semantics of the empty default for file_pattern remain undocumented.

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?

Specific verb+resource: 'Search file contents across repos', plus a concrete statement of what comes back ('GitHub links with line numbers'). It is clearly not one of the listing/show_* siblings, but it never distinguishes itself from the sibling 'search', which an agent could plausibly pick instead.

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

Usage Guidelines2/5

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

Usage is only implied by the word 'grep'/'Search'; there is no statement of when to use this versus 'search', 'search_by_image', or the docs/tests tools, and no exclusions or prerequisites. An agent must guess which search surface to pick.

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