> ## Documentation Index
> Fetch the complete documentation index at: https://docs.githits.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Documentation access: hosted and repo-backed docs

> Use search, docs_list, and docs_read to find, browse, and read hosted docs and repository-backed docs for indexed packages.

Documentation access gives your agent a direct way to inspect package docs without leaving the coding session. GitHits covers both hosted documentation and documentation files backed by repositories.

Use `search` when your agent knows the topic and needs the relevant docs page. Use `docs_list` when it needs to browse the available documentation set first. Use `docs_read` to read the exact page or line range.

Use these tools when docs explain the public API better than source code, or when your agent needs to compare documented behavior against implementation behavior.

<AccordionGroup>
  <Accordion title="search — find documentation by topic">
    `search` is the primary discovery tool for documentation questions. It can search indexed package docs alongside code and symbols, then return documentation hits that chain into `docs_read`.

    Use it when your agent knows the package and topic, such as an option name, guide title, error message, migration note, or API behavior.

    **CLI usage**

    ```bash theme={null}
    npx githits@latest search "middleware error handling" --in npm:express --source docs
    npx githits@latest search "streaming responses" --in pypi:requests --source docs
    ```

    **Key parameters**

    <ParamField query="query" type="string" required>
      Discovery query string. Describe the documentation topic, API, option, behavior, or error message you need.
    </ParamField>

    <ParamField query="target" type="string">
      Single search target. Package format: `npm:react@18.2.0` or `npm:react` for latest. Repository format: `https://github.com/facebook/react`.
    </ParamField>

    <ParamField query="source" type="string">
      Set to `docs` when you only want documentation results. Omit it when documentation can be mixed with code and symbol results.
    </ParamField>

    <ParamField query="limit" type="number">
      Maximum results to return.
    </ParamField>

    When a result points to documentation, pass its `pageId` to `docs_read` to read the page or a focused line range.
  </Accordion>

  <Accordion title="docs_list — browse documentation pages">
    `docs_list` lists available documentation pages for a package. It covers hosted/crawled docs and repository-backed documentation files.

    Every entry includes a stable `pageId`, a `sourceKind` (`crawled` or `repo`), and a source URL. Repository-backed entries also expose `repoUrl`, `gitRef`, and `filePath` for source follow-ups.

    **CLI usage**

    ```bash theme={null}
    npx githits@latest docs list npm:express
    npx githits@latest docs list pypi:requests --limit 20
    ```

    **Parameters**

    <ParamField query="registry" type="string" required>
      Package registry.
    </ParamField>

    <ParamField query="package_name" type="string" required>
      Package name. Scoped names are supported.
    </ParamField>

    <ParamField query="version" type="string">
      Optional package version.
    </ParamField>

    <ParamField query="limit" type="number">
      Maximum pages to return (1-500, default 100).
    </ParamField>

    <ParamField query="after" type="string">
      Pagination cursor from a previous `docs_list` response.
    </ParamField>
  </Accordion>

  <Accordion title="docs_read — read a documentation page">
    `docs_read` reads a single documentation page by its `pageId`. Pass the `pageId` returned by `docs_list` or from a `search` result.

    Use `start_line` and `end_line` to fetch a slice of a long page. The response carries `totalLines` so the agent can continue reading the next slice when needed.

    **CLI usage**

    ```bash theme={null}
    npx githits@latest docs read <pageId>
    npx githits@latest docs read <pageId> --lines 50-150
    ```

    **Parameters**

    <ParamField query="page_id" type="string" required>
      Documentation page ID from `docs_list` or `search` results.
    </ParamField>

    <ParamField query="start_line" type="number">
      Starting line (1-indexed). Omit for the full page.
    </ParamField>

    <ParamField query="end_line" type="number">
      Ending line (inclusive). Omit for end of page.
    </ParamField>
  </Accordion>
</AccordionGroup>

## MCP tool reference

| MCP tool    | CLI command                    | Purpose                                                            |
| ----------- | ------------------------------ | ------------------------------------------------------------------ |
| `search`    | `npx githits@latest search`    | Find documentation pages by topic, API, option, behavior, or error |
| `docs_list` | `npx githits@latest docs list` | Browse documentation pages for a package                           |
| `docs_read` | `npx githits@latest docs read` | Read a documentation page by page ID                               |
