Options
string
required
Regular expression pattern to search for
string
Whether search should be case sensitive (default: true)
string
Git reference to search in (defaults to repository’s default branch)
boolean
Resolve
ref against the ephemeral namespace instead of the persistent one (default: false)string
Array/List of Git pathspecs to limit search scope
string
Glob patterns for files to include
string
Glob patterns for files to exclude
string
File extensions to filter by (e.g.,
['.js', '.py'])string
Number of lines to include before each match
string
Number of lines to include after each match
string
Maximum total output lines the server will collect for a search (default: 2000, max: 2000 - the
default is already the maximum). You can lower it for cheap previews, but you cannot raise it. If
a search produces more lines than this cap, the result is capped and the response sets
incomplete_results to true.string
Maximum matches per file (default: 200)
string
Pagination cursor from previous response
string
Maximum results per page (default: 200)
string
Token TTL. Token TTL in seconds.
Response
The grep response includes:query: Echo of search parameters with resolved defaultsrepo: Information about the searched ref and commitmatches: Array of files with matching lines- Each match contains
pathandlinesarray - TypeScript: Lines include
lineNumber,text, andtype('match'or'context') - Python: Lines include
line_number,text, andtype('match'or'context')
- Each match contains
- TypeScript:
hasMoreandnextCursorfor pagination,incompleteResultsfor the search cap - Python:
has_moreandnext_cursorfor pagination,incomplete_resultsfor the search cap
Incomplete results vs. pagination
Two different fields report two different things:has_moreis about pagination. The server collected more matches than fit in this page. Keep requesting withnext_cursoruntilhas_moreisfalse. you will receive everything the server collected.incomplete_resultsis about the search cap from raw output ofgit grep. The search produced more thanlimits.maxLinesoutput lines (default and maximum: 2000), so the server stopped collecting at the cap. Matches beyond the cap exist in the repository but cannot be retrieved by paging.
has_more: true, incomplete_results: true), and paging it to the end (has_more: false) does not
necessarily make it complete.
When incomplete_results is true, narrow the search instead of paging harder: use a more specific
pattern, restrict paths, or add fileFilters.