Skip to main content
Glama

Search inside collected records

grep_collected_records
Read-only

Find and count matches across everything collected, without loading it.

Returns only matching lines with their line numbers — the records themselves never enter context. Use to count how often a theme recurs across many sources, or to locate the exact line ranges worth loading in full via read_collected_records. Matching is literal: use grep_collected_records for exact wording and counts, ask_collected_records when the question needs interpretation across records.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
regexYesPattern to search for across the selected records.
dataIdsYesThe Data records to scan. Each item is `{ id, version?, from?, to? }` — pass `{from, to}` to narrow the scan range within that record; emitted line numbers stay absolute. Required: scanning is always scoped to records you name.
maxMatchesNoCap on matches returned across all records (default 100, max 2000). When the cap is hit, every record with matches keeps representation — tighten the regex or scan fewer records.
regexFlagsNoStandard JavaScript RegExp flags as one contiguous string, e.g. `"i"`, `"im"`, `"is"`. Common ones: `i` (case-insensitive), `m` (^/$ match line boundaries), `s` (dot matches newlines). Omit for the default: case-sensitive, single-line. Matching is per-line, so `g` has no effect. An invalid flag rejects the call with INVALID_REGEX.
contextLinesNoLines of context around each match (default 2); each window spans up to `2 × contextLines + 1` lines.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Beyond the readOnlyHint annotation, the description discloses that the operation is non-loading and that records never enter context, which is critical for context management. It also states matching is literal, directly informing expectations. No contradiction with 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 three sentences, with the core purpose in the first sentence, return behavior in the second, and usage guidance in the third. No filler or redundancy.

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 description covers purpose, behavior, and usage guidance, and the schema fully documents all parameters. The only gap is that 'everything collected' could be misread as global scope until the schema clarifies dataIds is required; also output format is only summarized. Still, the combination of description and rich schema is sufficient for correct invocation.

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 the baseline is 3. The description adds general behavior (literal matching, returns lines/line numbers) but does not clarify parameter-specific semantics beyond what the schema already provides, such as regex flags or line-range behavior.

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 states a specific action and resource: find and count matches across collected records without loading them. It explicitly distinguishes itself from `read_collected_records` (which loads full records) and `ask_collected_records` (which interprets), so an agent can tell them apart.

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?

It explicitly tells when to use this tool: for exact wording and counts, and for locating line ranges to load via `read_collected_records`. It also names the alternative (`ask_collected_records`) for interpretive questions, giving clear when/when-not 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.

Resources