Context7 MCP

Get Context

Retrieve documentation context for a library
1 min read

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#
Show properties
type'json' | 'txt'#

Format of the response

  • json: Array of Documentation objects (default)
  • txt: Plain text format

Default: "json"

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#
Show properties
titlestringrequired#

Title of the documentation snippet

contentstringrequired#

The documentation content (includes code blocks in markdown format)

sourcestringrequired#

Source identifier for the snippet

Examples#

Use Cases#

Providing Context to LLMs#

Processing Individual Snippets#