Skip to main content

Get Context#

Retrieve documentation context for a specific library. Returns documentation as a JSON array of documentation snippets (default) or as plain text.

Arguments#

querystringrequired#

The user’s question or task (used for relevance ranking)

libraryIdstringrequired#

The library ID (e.g., /facebook/react)

optionsGetContextOptions#

Response#

The response type depends on the type option.

JSON Format (type: "json" or default)#

Returns Documentation[] - an array of documentation objects.

Text Format (type: "txt")#

Returns a string containing the documentation context ready to use in LLM prompts.

Documentationobject#

Examples#

Use Cases#

Providing Context to LLMs#

Processing Individual Snippets#