Skip to main content
Glama

Search file contents

grep
Read-only

Search workspace files with a JavaScript regex, returning matches as relative/path:LINE. Use it to locate symbols, strings, or patterns across a project.

Instructions

Search file contents in the workspace with a JavaScript regular expression and return matches as 'relative/path:LINE: '. Use this to find where a symbol, string or pattern appears. Narrow the search with path and include. Skips binary files and the .git, node_modules and .cache directories. Do not use it to list files (use list_files) or to read a known file (use read_file).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNoFile or directory to search, workspace-relative. Defaults to the workspace root.
includeNoGlob filter for file paths, e.g. '*.ts' or 'src/**/*.ts'. Patterns without a slash match the file name at any depth.
patternYesJavaScript regular expression source, e.g. 'function\s+main' or 'TODO:'. Not a shell glob.
workspaceNoWorkspace name (see workspace_list). Defaults to the primary workspace.
ignoreCaseNoCase-insensitive matching. Defaults to false.
maxResultsNoMaximum number of matching lines to return. Defaults to 100 and is capped at 1000.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.5.0

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, so the safe-read nature is covered without redundancy. The description adds genuinely useful behavior beyond annotations: it skips binary files and the .git, node_modules, and .cache directories, and it defines the exact match output shape. Minor gap: it does not spell out that matching is line-oriented rather than context/block based, though the output format implies it.

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?

Four sentences, each earning its place: core purpose and output format, usage trigger, narrowing strategy, behavioral caveat, and exclusions. The most decision-relevant fact is front-loaded, and no sentence is redundant with the annotations or schema.

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?

The definition is complete for a 6-parameter read-only search tool with no output schema. It covers what is searched, how matches are formatted, which directories are excluded, how to narrow the search, and which siblings to use instead. Parameter defaults live in the schema (maxResults cap, workspace default), and the read-only guarantee lives in the annotations.

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 100%, so all 6 parameters are already documented at the schema level; the baseline of 3 applies. The description adds only marginal strategic value by saying 'Narrow the search with path and include', which groups parameters into a usage pattern but does not add per-parameter detail beyond what the schema provides.

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 and resource ('Search file contents in the workspace') plus the mechanism (JavaScript regular expression) and an explicit output format ('relative/path:LINE: <line text>'). It clearly differentiates from siblings by stating this finds where a symbol, string, or pattern appears, and names list_files/read_file as the tools for adjacent tasks.

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 gives an explicit use case ('find where a symbol, string or pattern appears'), notes how to narrow results ('Narrow the search with path and include'), and names the two alternatives with the conditions that route to them ('Do not use it to list files (use list_files) or to read a known file (use read_file)'). An agent needs no inference to pick the right tool.

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