grep_in_file
Search a file's lines with a JS regex to locate specific references (e.g., URLs, code identifiers) that full-text search misses, returning matches with line numbers.
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) |