Skip to main content
Glama

grep

Read-only

Search files in a project using regex patterns. Supports glob filtering, case-insensitive matching, context lines, and output modes (paths, content with line numbers, or match counts). Results limited to 250 by default; use glob to narrow searches.

Instructions

Regex content search across a project's files. Postgres-backed, scoped to one project, with glob filtering.

Three output modes:

  • files_with_matches (default) — list paths containing a match

  • content — matching lines with optional context and line numbers

  • count — per-file match counts + total

Default head_limit is 250 to prevent context blowups on broad patterns. Use glob to narrow by path (e.g. 'api//*.js', 'public//.html'). Regex uses Postgres syntax (~ / ~). Invalid or catastrophic patterns error out via a 2s statement timeout — simplify the pattern if that happens.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesProject ID (e.g. proj_a8Kq7fR2xZ)
patternYesRegex pattern to search for
globNoPath filter glob (e.g. 'api/**/*.js', 'public/*.html')
output_modeNoOutput format
-iNoCase-insensitive match
-nNoShow line numbers in content mode (default true)
contextNoLines of context before/after each match (content mode)
head_limitNoMax results to return (default 250, max 1000)
Behavior5/5

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

The description goes beyond annotations by disclosing key behavioral traits: the default head_limit mechanism, the ability to narrow results with glob, the Postgres regex syntax and associated limitations (2s timeout for catastrophic patterns), and the three output modes. Annotations only indicate readOnly and non-destructive, but the description adds crucial details for effective use.

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 (four short paragraphs) and front-loaded with the core purpose. The bullet list of output modes is clear. Every sentence adds value; there is no redundancy or fluff.

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?

Given the complexity (8 parameters, multiple output modes) and the lack of an output schema, the description is complete. It covers all essential behavioral aspects, usage guidelines, and error conditions. The sibling context is well-handled by distinguishing grep from other search tools.

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?

While schema coverage is 100% and each parameter is described, the description adds significant value by explaining the default head_limit, how glob interacts with the search, and the formatting of output modes. However, a 4 is appropriate because the description doesn't add new parameter-level details beyond the schema for some parameters (e.g., '-i' and '-n' are already clear from their descriptions).

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 clearly specifies the verb ('search'), the resource ('project files'), and the method ('regex content search'). It distinguishes itself from siblings like 'read_file' and 'search_documentation' by focusing on regex-based content search with multiple output modes.

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?

The description provides explicit when-not-to-use guidance: it warns about the default head_limit of 250 to prevent context blowups, suggests using glob to narrow by path, and advises simplifying patterns if they cause errors. This helps agents decide when to use grep vs other tools like search_documentation.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Woobox/hatchable-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server