Introduction
@upstash/context7-tools-ai-sdk provides Vercel AI SDK compatible tools and agents that give your AI applications access to up-to-date library documentation through Context7.
This package enables you to:
- Add documentation lookup tools to your AI SDK workflows with
generateTextorstreamText - Create documentation-aware agents using the pre-configured
Context7Agent - Build RAG pipelines that retrieve accurate, version-specific code examples
Installation
Quick Start
Using Tools with generateText
Using the Context7 Agent
Authentication
Set your Context7 API key via environment variable:Package Contents
The package provides:Tools
resolveLibraryId- Searches Context7’s database to find the correct library IDqueryDocs- Fetches documentation for a specific library
Agents
Context7Agent- Pre-configured agent that handles multi-step documentation lookup
Prompts
SYSTEM_PROMPT- Basic documentation assistant promptAGENT_PROMPT- Detailed multi-step workflow promptRESOLVE_LIBRARY_ID_DESCRIPTION- Tool description for resolveLibraryIdQUERY_DOCS_DESCRIPTION- Tool description for queryDocs
Next Steps
Tools
Learn about resolveLibraryId and queryDocs tools
Agent
Use the pre-configured Context7Agent