Search inside collected records
grep_collected_recordsFind 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
| Name | Required | Description | Default |
|---|---|---|---|
| regex | Yes | Pattern to search for across the selected records. | |
| dataIds | Yes | The 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. | |
| maxMatches | No | Cap 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. | |
| regexFlags | No | Standard 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. | |
| contextLines | No | Lines of context around each match (default 2); each window spans up to `2 × contextLines + 1` lines. |