Skip to main content
Glama

grep

Read-only

Search file contents with a regular expression (RE2 syntax, no backreferences or lookaround). Omit both path and prefix to search every text file in the workspace; pass prefix to search one folder, or path to search a single file. Returns matching lines with 1-based line numbers and surrounding context; line numbers are display-only, never include them in edit's old_str. Matches within single lines only. Use grep to locate exact text; use read to view the surrounding region.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNoSearch a single file at this path instead of a folder.
prefixNoSearch only files under this folder. Omit both path and prefix to search the whole workspace.
patternYesRE2 regular expression. No backreferences or lookaround.
workspaceNoWorkspace slug. Optional, defaults to "temp".
max_matchesNoStop after this many matches.
context_linesNoLines of surrounding context to return around each match.
case_sensitiveNoMatch case exactly.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.9/5.0
Behavior5/5

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

Beyond the readOnlyHint annotation, the description discloses return format (matching lines with 1-based line numbers and context), that line numbers are display-only and must not be used in edit, that matches are single-line only, and the RE2 syntax limitations. This adds substantial behavioral context not in the annotations.

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?

The description is concise yet information-dense. Each sentence serves a purpose: main action, scoping modes, output format, and tool selection. It is front-loaded with the core purpose and does not waste words.

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?

With 7 parameters and no output schema, the description covers essential context: return shape, line-number safety, single-line matching, workspace-wide search behavior, and regex syntax. It also addresses the common usage pattern of locating text before reading surrounding context, making it complete for this tool's complexity.

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 baseline is 3. The description adds value by clarifying the interaction between path and prefix ('Omit both path and prefix... pass prefix... path...'), which is not fully explicit in the schema, and reinforces RE2 constraints. It does not add semantics for max_matches or case_sensitive, but the schema handles those.

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?

The description opens with a specific verb+resource: 'Search file contents with a regular expression'. It clearly distinguishes from siblings by adding 'Use grep to locate exact text; use read to view the surrounding region', and the line-number caveat separates it from edit.

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?

Explicit scoping instructions are given: omit both path and prefix for whole-workspace search, use prefix for a folder, path for a single file. It also names an alternative tool ('use read') and warns against using line numbers in edit old_str, providing clear when-to-use vs when-not-to guidance.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.