Search repository code with a regex pattern. Like the Unix ‘grep’ command, but for indexed repository code. Searches through all code chunks and returns matches with context.
By default (exhaustive=true), iterates through ALL indexed chunks to find every match, providing true grep-like behavior. For faster but potentially incomplete results, set exhaustive=false to use BM25 keyword search first.
Supports asymmetric context lines (A for after, B for before), case sensitivity, whole word matching, and multiple output modes.
API key must be provided in the Authorization header
Repository identifier in owner/repo format
Regex pattern to search for in repository code
"async function\\s+\\w+"
Limit search to files with this path prefix
"src/"
Lines before AND after each match (shorthand for A/B). Overridden by A or B if specified.
0 <= x <= 10Lines after each match (like grep -A). Overrides context_lines for after.
0 <= x <= 20Lines before each match (like grep -B). Overrides context_lines for before.
0 <= x <= 20Case-sensitive matching (default is case-insensitive)
Match whole words only
Treat pattern as literal string, not regex
Maximum matches to return per file
1 <= x <= 100Maximum total matches to return
1 <= x <= 1000Output format:
content, files_with_matches, count Add >>markers<< around matched text in results
Include line numbers in results
Group matches by file in results
Search ALL chunks for complete results (default: true). When true, iterates through all indexed chunks to find every match (like real grep). When false, uses BM25 keyword search to find top candidates first (faster but may miss matches). Automatically enabled when pattern has no extractable keywords.
Search completed successfully
Matches grouped by file path (when group_by_file is true)
List of file paths (when output_mode is 'files_with_matches')
Match counts per file (when output_mode is 'count')
The regex pattern that was searched
Path filter that was applied
Total number of matches found
Number of code chunks searched
Number of files that contained matches
Whether results were truncated due to limits
Applied search options