grep_in_file
Match a regex pattern against a file's lines and retrieve matched lines with line numbers, capturing what full-text search misses like URLs and code identifiers.
Instructions
Match a JS regex against one file's lines and return matched lines with line numbers (capped: default 100, max 500). Catches what FTS misses: URLs, hyphenated terms, code identifiers. Read-only; no side effects, auth, or rate limits. Invalid regex throws invalid regex. Returns {matches, match_count, truncated}. Use after read_file_outline when you know the file but need a specific reference; for cross-file regex use regex_search; for keyword/concept search use search.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | File ID | |
| pattern | Yes | Pattern to match. Treated as a JavaScript RegExp source. | |
| case_insensitive | No | Add the 'i' flag (default false) | |
| max_matches | No | Cap on returned hits (default 100) |