Created
March 7, 2026 20:55
-
-
Save bizrockman/154ad443f34944cb827eec6bbece4a44 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "openapi": "3.0.3", | |
| "info": { | |
| "title": "Context7 Documentation API", | |
| "description": "Search programming libraries and retrieve up-to-date documentation and code examples. Use search_libraries first to resolve a library name to a Context7 library ID, then use query_documentation to fetch relevant docs.", | |
| "version": "2.0.0", | |
| "contact": { | |
| "name": "Context7", | |
| "url": "https://context7.com" | |
| } | |
| }, | |
| "servers": [ | |
| { | |
| "url": "https://context7.com/api" | |
| } | |
| ], | |
| "security": [ | |
| {}, | |
| { "bearerAuth": [] } | |
| ], | |
| "components": { | |
| "securitySchemes": { | |
| "bearerAuth": { | |
| "type": "http", | |
| "scheme": "bearer", | |
| "description": "Optional Context7 API key as Bearer token. Requests without a key may be rate-limited." | |
| } | |
| }, | |
| "schemas": { | |
| "LibrarySearchResult": { | |
| "type": "object", | |
| "properties": { | |
| "id": { | |
| "type": "string", | |
| "description": "Context7-compatible library ID (format: /org/project). Pass this to query_documentation." | |
| }, | |
| "name": { | |
| "type": "string", | |
| "description": "Library or package name." | |
| }, | |
| "description": { | |
| "type": "string", | |
| "description": "Short summary of the library." | |
| }, | |
| "codeSnippets": { | |
| "type": "integer", | |
| "description": "Number of available code examples. Higher is better for documentation coverage." | |
| }, | |
| "sourceReputation": { | |
| "type": "string", | |
| "enum": ["High", "Medium", "Low", "Unknown"], | |
| "description": "Authority indicator of the documentation source." | |
| }, | |
| "benchmarkScore": { | |
| "type": "number", | |
| "description": "Quality indicator (0-100). Higher is better." | |
| }, | |
| "versions": { | |
| "type": "array", | |
| "items": { "type": "string" }, | |
| "description": "Available versions (format: /org/project/version). Use if the user asks for a specific version." | |
| } | |
| } | |
| }, | |
| "ErrorResponse": { | |
| "type": "object", | |
| "properties": { | |
| "error": { | |
| "type": "string", | |
| "description": "Human-readable error message." | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "BadRequest": { | |
| "description": "Invalid or missing required parameters.", | |
| "content": { | |
| "application/json": { | |
| "schema": { "$ref": "#/components/schemas/ErrorResponse" } | |
| } | |
| } | |
| }, | |
| "TooManyRequests": { | |
| "description": "Rate limit exceeded. Retry after the interval indicated in the Retry-After header.", | |
| "headers": { | |
| "Retry-After": { | |
| "schema": { "type": "integer" }, | |
| "description": "Seconds to wait before retrying." | |
| } | |
| }, | |
| "content": { | |
| "application/json": { | |
| "schema": { "$ref": "#/components/schemas/ErrorResponse" } | |
| } | |
| } | |
| }, | |
| "ServerError": { | |
| "description": "Unexpected server error. Retry with a simpler query or try again later.", | |
| "content": { | |
| "application/json": { | |
| "schema": { "$ref": "#/components/schemas/ErrorResponse" } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "paths": { | |
| "/v2/libs/search": { | |
| "get": { | |
| "operationId": "searchlibraries", | |
| "summary": "Resolve a library name to a Context7-compatible library ID", | |
| "description": "Resolves a package/product name to a Context7-compatible library ID and returns matching libraries.\n\nYou MUST call this tool before 'query_documentation' to obtain a valid library ID, UNLESS the user explicitly provides one in the format '/org/project' or '/org/project/version'.\n\nEach result includes:\n- Library ID (format: /org/project)\n- Name and description\n- Code Snippets: number of available code examples\n- Source Reputation: High, Medium, Low, or Unknown\n- Benchmark Score: quality indicator (100 is the highest)\n- Versions: available versions (format: /org/project/version)\n\nSelection criteria (in order of priority):\n1. Name similarity to the query (exact matches first)\n2. Description relevance to the user's intent\n3. Documentation coverage (prefer higher Code Snippet counts)\n4. Source reputation (prefer High or Medium)\n5. Benchmark Score\n\nIf multiple good matches exist, pick the most relevant one and explain why. If no good matches exist, suggest query refinements.\n\nIMPORTANT: Do not call this tool more than 3 times per question.", | |
| "parameters": [ | |
| { | |
| "name": "query", | |
| "in": "query", | |
| "required": true, | |
| "description": "The question or task the user needs help with. Used to rank library results by relevance. Example: 'How to set up authentication in Express.js'.", | |
| "schema": { | |
| "type": "string" | |
| } | |
| }, | |
| { | |
| "name": "libraryName", | |
| "in": "query", | |
| "required": true, | |
| "description": "Library or package name to search for (e.g. 'react', 'fastapi', 'next.js', 'langchain').", | |
| "schema": { | |
| "type": "string" | |
| } | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Search results with matching libraries ranked by relevance.", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "type": "object", | |
| "properties": { | |
| "results": { | |
| "type": "array", | |
| "items": { "$ref": "#/components/schemas/LibrarySearchResult" } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "400": { "$ref": "#/components/responses/BadRequest" }, | |
| "429": { "$ref": "#/components/responses/TooManyRequests" }, | |
| "500": { "$ref": "#/components/responses/ServerError" } | |
| } | |
| } | |
| }, | |
| "/v2/context": { | |
| "get": { | |
| "operationId": "querydocumentation", | |
| "summary": "Retrieve documentation and code examples for a library", | |
| "description": "Fetches up-to-date, reranked documentation and code examples for the specified library.\n\nYou MUST call 'search_libraries' first to obtain a valid Context7 library ID, UNLESS the user explicitly provides one in the format '/org/project' or '/org/project/version'.\n\nBe specific in your query for best results. Good: 'How to set up authentication with JWT in Express.js'. Bad: 'auth'.\n\nIMPORTANT: 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.", | |
| "parameters": [ | |
| { | |
| "name": "query", | |
| "in": "query", | |
| "required": true, | |
| "description": "Specific question or topic to retrieve documentation for. Be detailed. Example: 'React useEffect cleanup function examples'.", | |
| "schema": { | |
| "type": "string" | |
| } | |
| }, | |
| { | |
| "name": "libraryId", | |
| "in": "query", | |
| "required": true, | |
| "description": "Context7-compatible library ID obtained from search_libraries (e.g. '/mongodb/docs', '/vercel/next.js', '/vercel/next.js/v14.3.0-canary.87').", | |
| "schema": { | |
| "type": "string" | |
| } | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "Documentation content with code examples as plain text.", | |
| "content": { | |
| "text/plain": { | |
| "schema": { | |
| "type": "string" | |
| } | |
| } | |
| } | |
| }, | |
| "400": { "$ref": "#/components/responses/BadRequest" }, | |
| "429": { "$ref": "#/components/responses/TooManyRequests" }, | |
| "500": { "$ref": "#/components/responses/ServerError" } | |
| } | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment