Skip to main content
Glama

Grep

grep
Read-only

Search file contents by regular expression or literal text, optionally narrowing by path and include glob, and return matching path:line: text results.

Instructions

Search file contents with a regular expression (or literal text). Narrow with path and include, e.g. include='*.ts'. Returns path:line: text.

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": "grep"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathNo
limitNo
includeNo
literalNo
patternYes
caseSensitiveNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A3.5/5.0
Behavior3/5

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

Annotations already establish readOnlyHint=true and openWorldHint=false, so safety is covered, and the description adds the return shape ('path:line: text'). It does not disclose the regex flavor, default case sensitivity, or what happens when the 100-result limit is hit, which are the behaviors an agent would still want to know.

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 and followed by narrowing advice and the return format. Every sentence carries information, with no boilerplate or repetition of the schema.

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?

The tool is simple, an output schema exists so return values need not be spelled out, and the description covers the search mode and the main filters. The remaining gap is result-limit behavior, which matters for a search tool but is a minor omission given the rest of the coverage.

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 0%, so the description carries the burden; it explains the required pattern, plus path and include with a concrete example. The limit, literal, and caseSensitive parameters are left to their self-explanatory names, and the default truncation behavior behind limit is unexplained.

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?

The description names a specific verb and resource — 'Search file contents with a regular expression (or literal text)' — which lets an agent distinguish content search from filename-oriented siblings like glob and read. It stops short of explicitly naming those siblings as alternatives, so it is clear but not fully differentiated.

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?

It offers practical narrowing advice ('Narrow with path and include, e.g. include="*.ts"'), which is usage guidance for parameters rather than for tool selection. There is no explicit statement of when to prefer this over glob, read, or shell, so an agent must infer the boundary itself.

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