# getDocumentation

**Identifier:** `context7_getDocumentation`

**Provider:** [Context7](https://kirha.com/providers/context7.md)

Retrieve up-to-date documentation snippets (code examples and explanations) for a library, ranked by relevance to a query. Use a libraryId from searchLibraries.

## Run it with the CLI

```bash
kirha tools run context7_getDocumentation \
  --input '{
    "libraryId": "/react/react",
    "query": "<query>"
  }'
```

`--input` takes a JSON object that matches the input schema. Pass `--input -` to read it from stdin.

## Call it over HTTP

```bash
curl https://api.kirha.com/tools/v1/execute \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: **********' \
  --data '{
  "tool_name": "context7_getDocumentation",
  "input": {
    "libraryId": "/react/react",
    "query": "<query>"
  }
}'
```

Replace the stars with an API key from https://app.kirha.com/api-keys.

## Input schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "libraryId": {
      "description": "From searchLibraries, e.g., /react/react",
      "type": "string"
    },
    "page": {
      "default": 1,
      "maximum": 10,
      "minimum": 1,
      "type": "number"
    },
    "query": {
      "description": "Specific question for documentation search",
      "type": "string"
    },
    "topic": {
      "description": "Focus area, e.g., hooks, routing",
      "type": "string"
    }
  },
  "required": [
    "libraryId",
    "query"
  ],
  "type": "object"
}
```

## Output schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "codeSnippets": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "code": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "language": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "title": {
            "type": "string"
          }
        },
        "required": [
          "title",
          "code"
        ],
        "type": "object"
      },
      "type": "array"
    },
    "context": {
      "type": "string"
    },
    "infoSnippets": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "breadcrumb": {
            "type": "string"
          },
          "content": {
            "type": "string"
          },
          "source": {
            "type": "string"
          }
        },
        "required": [
          "content"
        ],
        "type": "object"
      },
      "type": "array"
    }
  },
  "required": [
    "context",
    "codeSnippets",
    "infoSnippets"
  ],
  "type": "object"
}
```

## Related tools

Other Context7 tools that this tool refers to, or that refer to it.

- [`searchLibraries`](https://kirha.com/providers/context7/searchLibraries.md)

-----

[All Context7 tools](https://kirha.com/providers/context7.md) · [< Back to tools list](https://kirha.com/tools.md)