Tool Selection
| 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 |
Decision Flow
- •
Is the library well-known (React, Python stdlib, popular npm packages)?
- •Yes: Start with Context7
- •No: Start with Ref
- •
Do you need code snippets or API signatures?
- •Yes: Prefer Context7
- •No (need explanations/tutorials): Prefer Ref
- •
Did the first tool return insufficient results?
- •Yes: Try the other tool as fallback
Combining Tools
For comprehensive research, use both tools:
- •Context7 for official API documentation and code examples
- •Ref for community solutions, tutorials, and edge cases
When the agent returns, synthesize findings into actionable guidance for the user.
Tool Usage Examples
Context7 workflow:
- •Call
resolve-library-idwith the library name to get the Context7 library ID - •Call
query-docswith the returned library ID and your specific question
Ref workflow:
- •Call
ref_search_documentationwith a descriptive query including language/framework names - •Call
ref_read_urlwith the exact URL from results (include the #hash portion)