Search library/API documentation using Context7 and Ref MCP tools. Use when Claude needs to: (1) Look up API syntax or code snippets, (2) Search library documentation, (3) Research implementation patterns, (4) Debug issues using docs, or (5) Explore unfamiliar libraries or frameworks.
| Scenario | Tool | Reason | |----------|------|--------| | Known library, need code examples | Context7 | Optimized for retrieving code snippets | | General API reference lookup | Context7 | Fast, structured documentation access | | Obscure/niche library | Ref | Broader search across multiple sources | | Concept explanation or tutorials | Ref | Better for prose and explanatory content | | Debugging with error messages | Ref | Can search Stack Overflow, GitHub issues | | Cross-library comparison | Ref | Searches across multiple documentation sources | | Version-specific behavior | Both | Context7 for latest docs, Ref to find version-specific pages | | Multi-library question | Both | Resolve each library separately, then combine findings |
Is the library well-known (React, Python stdlib, popular npm packages)?
Do you need code snippets or API signatures?
Is the question version-specific (e.g., "I'm using React 17, not 18")?
Does the question span multiple libraries (e.g., "how to use pandas with SQLAlchemy")?
resolve-library-id for each), then query each one.Are you unsure which tool to use?
Did the first tool return insufficient results?
Good queries are specific and include the library name, the function or concept, and the action. Avoid vague natural-language questions.
For Context7 resolve-library-id:
pandas, react, fastapi, expressthe python data analysis library, facebook's frontend frameworkFor Context7 query-docs:
read_csv skip rows -- names the function and the parameter concernuseEffect cleanup function -- names the hook and the specific aspectRouter middleware order of execution -- names the component and the behaviorhow to skip rows -- too vague, missing function namehow does useEffect work -- too broad, will return too muchmiddleware -- too genericFor Ref ref_search_documentation:
python pandas read_csv skiprows parameterexpress.js error handling middleware next functionrust serde deserialize enum variantshow to skip rows in a csv file -- missing library nameerror handling -- far too vaguewhy doesn't my middleware work -- conversational, not searchableContext7 workflow:
resolve-library-id with the library name to get the Context7 library ID.
pandasreactquery-docs with the returned library ID and a specific query.
/python/pandas and query read_csv skiprows parameter/facebook/react and query useEffect cleanup return functionRef workflow:
ref_search_documentation with a descriptive query including the language/framework name.
python pandas read_csv skip rowsexpress.js middleware error handling nextrust tokio spawn blocking vs spawnref_read_url with the exact URL from results (include the #hash portion if present).
When a tool returns no results:
resolve-library-id returned the correct library. Some libraries have non-obvious IDs.When a tool returns too many results or irrelevant results:
python requests timeout instead of requests timeout).When resolve-library-id returns multiple candidates:
requests library vs. an unrelated npm package also called requests).When results seem outdated or conflict with what you know:
When combining information from multiple sources or tool calls:
Libraries change between major versions. When the user specifies a version (or when their code implies one):
https://reactjs.org/docs/ vs. https://legacy.reactjs.org/). Include the version number in your Ref search query.For comprehensive research, use both tools:
When both tools return results, synthesize findings into actionable guidance. Do not dump raw documentation at the user -- extract the relevant parts and explain how they apply to the user's specific question.
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer