searchRef or an INDEXING status that you can poll with search_status.
Supported languages for code indexing: Bash, C#, C++, CSS, Dart, Elixir, Erlang, Go, Java, JavaScript, Kotlin, Lua, Markdown, PHP, Proto, Python, R, Ruby, Rust, Scala, SCSS, Swift, TypeScript, Zig, and more.
search — unified code, docs, and symbol search
search — unified code, docs, and symbol search
search is the primary discovery tool. It searches across code, documentation, and explicit symbols in any indexed package or GitHub repository. Use it when you need to find where something is defined, which files handle a specific concern, or which docs page explains a behavior.Query syntax supports implicit AND, uppercase OR, grouping with parentheses, negation with -, quoted phrases, and semantic qualifiers:Scope targets with the registry prefix format (
npm:react, pypi:requests) or a full GitHub URL (https://github.com/expressjs/express). In the CLI, pass targets with repeatable --in flags. In MCP, pass target for one target or targets for multiple targets.CLI usagestring
required
Discovery query string. Supports AND (implicit), OR (uppercase), parentheses,
- negation, quoted phrases, and semantic qualifiers (kind:, category:, path:, lang:, name:, intent:).string
Single search target. Package format:
npm:react@18.2.0 or npm:react for latest. Repository format: https://github.com/facebook/react.array
Multiple search targets. Use either
target or targets, not both.string
Restrict results to
code, symbol, or docs. Omit to let GitHits choose the best indexed sources. See Documentation Access for docs-focused search, listing, and reading workflows.boolean
When
true, returns hits from sources that finished indexing while others continue, plus a searchRef for continuation. Defaults to false (waits for all sources).number
Maximum results to return (default 10, max 100).
type field tells you which follow-up tool to use:repository_codeorrepository_symbol→code_readwithlocator.filePath(andlocator.startLine/endLinewhen present)- Documentation hits →
docs_readwith the result’spageId
search_status — poll async indexing progress
search_status — poll async indexing progress
search_status lets you follow up on a search response that returned a searchRef instead of hits. This happens when indexing is still running. Pass the searchRef from the prior search response to check progress, fetch partial hits, or retrieve final results.CLI usagestring
required
The
searchRef value from a prior search response. Pass it through unchanged (the response field uses camelCase; this parameter uses snake_case).code_files — list files in an indexed package or repo
code_files — list files in an indexed package or repo
code_files lists the files contained in an indexed dependency or repository. Use it to discover paths before calling code_read, to scope a code_grep, or to explore the structure of an unfamiliar package.Filter results by path prefix, glob patterns, file extensions, programming language, or file intent (production source, tests, examples, generated files, etc.).CLI usageobject
required
Package target (
registry + package_name) or repository target (repo_url + optional git_ref). Mutually exclusive.string
Literal directory prefix to filter by (e.g.,
src/ or lib/parser). Not a glob — use globs for pattern matching.array
Glob selectors with full glob semantics (e.g.,
src/**/*.ts). Combined with OR logic alongside path and path_prefix.array
File extensions to include, without a leading dot (e.g.,
["ts", "js"]). In the CLI, use repeatable --ext flags.array
Language filters matching aigrep language names.
string
Inclusive file-intent filter:
production, test, benchmark, example, generated, fixture, build, or vendor.boolean
Exclude documentation files after inclusive filtering.
boolean
Exclude test files after inclusive filtering.
number
Maximum entries to return (1–1000, default 200).
{total, hasMore, files: [{path, name, language, fileType, byteSize}], resolution, indexedVersion}.code_read — read source files at exact line ranges
code_read — read source files at exact line ranges
code_read reads a specific file from an indexed dependency at exact line ranges. Use the filePath from a search, code_grep, or code_files result to target the file, then set start_line and end_line to fetch only the window you need.The MCP surface caps each read at 150 lines per call. If you request a broader range, the response truncates to 150 lines from your start point and includes a hint with the continuation start_line for the next call. The CLI command npx githits@latest code read has no line cap.CLI usageobject
required
Package target (
registry + package_name) or repository target (repo_url + optional git_ref). Mutually exclusive.string
required
Exact file path to read. Use
code_files to discover paths when you receive a FILE_NOT_FOUND error.number
Starting line (1-indexed). Omit to start at line 1.
number
Ending line (inclusive). When omitted, defaults to
start_line + 149 because the MCP surface caps each read at 150 lines.{path, language, totalLines, startLine, endLine, content, isBinary, hint?}. Binary files set isBinary: true and omit content.code_grep — deterministic grep over indexed source
code_grep — deterministic grep over indexed source
code_grep runs a deterministic text or regex grep over the indexed source files of a package or repository. Use it when you know the exact string or pattern you are looking for. Use search for discovery when you do not.Grep results include the matching file path and line number, which chain directly into code_read — pass filePath as path and pick a window around match.line for start_line/end_line.CLI usageobject
required
Package target (
registry + package_name) or repository target (repo_url + optional git_ref). Mutually exclusive.string
The text pattern to search for. Literal by default.
string
default:"literal"
literal (default) or regex (RE2 syntax). In the CLI, pass --regex for regex mode.string
Literal directory prefix to scope the grep (e.g.,
src/).array
Glob selectors (e.g.,
src/**/*.ts).array
File extensions to include, without a leading dot. In the CLI, use repeatable
--ext flags.boolean
Case-sensitive matching. Defaults to
false.number
Lines of context before and after each match (equivalent to
grep -C).number
Cap on total matches returned.