context7-query-docs
To fetch up-to-date docs and code examples from Context7 for a known library, query by a resolved library ID after running resolve-library-id (max 3 calls).
When & Why to Use This Skill
The context7-query-docs skill enables Claude to retrieve up-to-date documentation and functional code examples for a vast array of programming libraries and frameworks. By connecting to Context7, it provides developers with real-time technical insights and version-specific implementation details, effectively bridging the gap between AI knowledge and the latest software releases to streamline coding and debugging workflows.
Use Cases
- Case 1: Fetching precise code examples for specific library versions, such as implementing new features in Next.js v14 or React Server Components.
- Case 2: Troubleshooting integration issues by querying the latest official documentation for libraries like MongoDB, Supabase, or Express.js.
- Case 3: Rapidly onboarding to unfamiliar frameworks by requesting 'how-to' guides and best practice snippets directly within the chat interface.
- Case 4: Reducing development time by automating the search for API references and syntax requirements for complex third-party dependencies.
| name | context7-query-docs |
|---|---|
| description | "To fetch up-to-date docs and code examples from Context7 for a known library, query by a resolved library ID after running resolve-library-id (max 3 calls)." |
Usage
Use the MCP tool dev-swarm.request to send the payload as a JSON string:
{"server_id":"context7","tool_name":"query-docs","arguments":{}}
Tool Description
Retrieves and queries up-to-date documentation and code examples from Context7 for any programming library or framework. You must call 'resolve-library-id' first to obtain the exact Context7-compatible library ID required to use this tool, UNLESS the user explicitly provides a library ID in the format '/org/project' or '/org/project/version' in their query. IMPORTANT: Do not call this tool more than 3 times per question. If you cannot find what you need after 3 calls, use the best information you have.
Arguments Schema
The schema below describes the arguments object in the request payload.
{
"type": "object",
"properties": {
"libraryId": {
"type": "string",
"description": "Exact Context7-compatible library ID (e.g., '/mongodb/docs', '/vercel/next.js', '/supabase/supabase', '/vercel/next.js/v14.3.0-canary.87') retrieved from 'resolve-library-id' or directly from user query in the format '/org/project' or '/org/project/version'."
},
"query": {
"type": "string",
"description": "The question or task you need help with. Be specific and include relevant details. Good: 'How to set up authentication with JWT in Express.js' or 'React useEffect cleanup function examples'. Bad: 'auth' or 'hooks'. IMPORTANT: Do not include any sensitive or confidential information such as API keys, passwords, credentials, or personal data in your query."
}
},
"required": [
"libraryId",
"query"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
Background Tasks
If the tool returns a task id, poll the task status via the MCP request tool:
{"server_id":"context7","method":"tasks/status","params":{"task_id":"<task_id>"}}