Skip to main content
Beta

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 defaults
  • repo: Information about the searched ref and commit
  • matches: Array of files with matching lines
    • Each match contains path and lines array
    • TypeScript: Lines include lineNumber, text, and type ('match' or 'context')
    • Python: Lines include line_number, text, and type ('match' or 'context')
  • TypeScript: hasMore and nextCursor for pagination, incompleteResults for the search cap
  • Python: has_more and next_cursor for pagination, incomplete_results for the search cap

Incomplete results vs. pagination

Two different fields report two different things:
  • has_more is about pagination. The server collected more matches than fit in this page. Keep requesting with next_cursor until has_more is false. you will receive everything the server collected.
  • incomplete_results is about the search cap from raw output of git grep. The search produced more than limits.maxLines output 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.
The two combine independently: a capped result can still span several pages (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.