Context7 Documentation Lookup
Use the Context7 MCP tools to fetch accurate, up-to-date documentation for any library.
Process
Step 1: Resolve Library ID
First, find the Context7-compatible library ID:
Use tool: mcp__plugin_context7_context7__resolve-library-id
Parameter: libraryName = "<library name>"
Examples:
- For tokio:
libraryName = "tokio"
- For serde:
libraryName = "serde"
- For React:
libraryName = "react"
- For Express:
libraryName = "express"
Step 2: Fetch Documentation
After getting the library ID, fetch documentation:
Use tool: mcp__plugin_context7_context7__get-library-docs
Parameters:
- context7CompatibleLibraryID = "<id from step 1>"
- topic = "<specific topic>" (optional)
- mode = "code" or "info"
Modes:
code (default): API references, code examples, function signatures
info: Conceptual guides, architecture, narrative documentation
Step 3: Paginate if Needed
If documentation is incomplete, fetch more pages:
Use tool: mcp__plugin_context7_context7__get-library-docs
Parameters:
- context7CompatibleLibraryID = "<same id>"
- topic = "<same topic>"
- page = 2 (or 3, 4, etc.)
Common Lookup Patterns
Rust Crates
# Tokio async runtime
resolve-library-id: "tokio"
get-library-docs: topic="spawn", mode="code"
# Serde serialization
resolve-library-id: "serde"
get-library-docs: topic="derive", mode="code"
# Axum web framework
resolve-library-id: "axum"
get-library-docs: topic="routing", mode="code"
# sqlx database
resolve-library-id: "sqlx"
get-library-docs: topic="query", mode="code"
Understanding Concepts
# Learn about Tokio architecture
get-library-docs: topic="runtime", mode="info"
# Understand serde data model
get-library-docs: topic="data model", mode="info"
Specific APIs
# Tokio channels
get-library-docs: topic="mpsc channel", mode="code"
# Axum extractors
get-library-docs: topic="extractor", mode="code"
# tracing spans
get-library-docs: topic="span", mode="code"
When to Use Context7
Always use for:
- Looking up API details for external crates
- Finding correct function signatures
- Getting usage examples
- Understanding library patterns
- Checking latest API changes
Use mode="code" when:
- Need function signatures
- Want code examples
- Looking for API reference
- Implementing features
Use mode="info" when:
- Understanding architecture
- Learning concepts
- Reading guides
- Design decisions
Integration with Development
Before Implementation
- Resolve library ID for relevant crates
- Fetch documentation for the specific API you'll use
- Check examples for correct usage patterns
During Debugging
- Fetch docs for error types
- Look up correct parameter types
- Find working examples
Example Workflow
Task: Implement async HTTP client with reqwest
1. resolve-library-id: "reqwest"
-> Returns: "/seanmonstar/reqwest"
2. get-library-docs:
context7CompatibleLibraryID: "/seanmonstar/reqwest"
topic: "client"
mode: "code"
-> Returns: Client builder patterns, request methods
3. get-library-docs:
context7CompatibleLibraryID: "/seanmonstar/reqwest"
topic: "error handling"
mode: "code"
-> Returns: Error types, retry patterns
Tips
- Be specific with topics for better results
- Use page parameter if first page doesn't have what you need
- Combine mode="info" for understanding + mode="code" for implementation
- Cache library IDs mentally for frequently used crates
- Check multiple topics if needed (e.g., "client" then "request builder")
Common Rust Ecosystem Lookups
| Crate |
Common Topics |
| tokio |
spawn, select, channel, time, sync |
| serde |
derive, serialize, deserialize, attributes |
| axum |
router, handler, extractor, middleware |
| sqlx |
query, pool, transaction, migrate |
| tracing |
span, event, subscriber, instrument |
| anyhow |
context, bail, ensure |
| thiserror |
error, from, source |
| clap |
parser, derive, subcommand, arg |
| reqwest |
client, request, response, error |
| hyper |
server, client, body |
1---2name: context7-docs-23description: Documentation lookup using Context7 MCP server. Use when needing up-to-date documentation for any library, crate, framework, or API. Always use this for Rust crates, npm packages, Python libraries, or any external dependency documentation.4---5
6# Context7 Documentation Lookup
7
8Use the Context7 MCP tools to fetch accurate, up-to-date documentation for any library.
9
10## Process
11
12### Step 1: Resolve Library ID
13
14First, find the Context7-compatible library ID:
15
16```
17Use tool: mcp__plugin_context7_context7__resolve-library-id
18Parameter: libraryName = "<library name>"
19```
20
21Examples:
22- For tokio: `libraryName = "tokio"`
23- For serde: `libraryName = "serde"`
24- For React: `libraryName = "react"`
25- For Express: `libraryName = "express"`
26
27### Step 2: Fetch Documentation
28
29After getting the library ID, fetch documentation:
30
31```
32Use tool: mcp__plugin_context7_context7__get-library-docs
33Parameters:
34 - context7CompatibleLibraryID = "<id from step 1>"
35 - topic = "<specific topic>" (optional)
36 - mode = "code" or "info"
37```
38
39**Modes:**
40- `code` (default): API references, code examples, function signatures
41- `info`: Conceptual guides, architecture, narrative documentation
42
43### Step 3: Paginate if Needed
44
45If documentation is incomplete, fetch more pages:
46
47```
48Use tool: mcp__plugin_context7_context7__get-library-docs
49Parameters:
50 - context7CompatibleLibraryID = "<same id>"
51 - topic = "<same topic>"
52 - page = 2 (or 3, 4, etc.)
53```
54
55## Common Lookup Patterns
56
57### Rust Crates
58
59```
60# Tokio async runtime
61resolve-library-id: "tokio"
62get-library-docs: topic="spawn", mode="code"
63
64# Serde serialization
65resolve-library-id: "serde"
66get-library-docs: topic="derive", mode="code"
67
68# Axum web framework
69resolve-library-id: "axum"
70get-library-docs: topic="routing", mode="code"
71
72# sqlx database
73resolve-library-id: "sqlx"
74get-library-docs: topic="query", mode="code"
75```
76
77### Understanding Concepts
78
79```
80# Learn about Tokio architecture
81get-library-docs: topic="runtime", mode="info"
82
83# Understand serde data model
84get-library-docs: topic="data model", mode="info"
85```
86
87### Specific APIs
88
89```
90# Tokio channels
91get-library-docs: topic="mpsc channel", mode="code"
92
93# Axum extractors
94get-library-docs: topic="extractor", mode="code"
95
96# tracing spans
97get-library-docs: topic="span", mode="code"
98```
99
100## When to Use Context7
101
102**Always use for:**
103- Looking up API details for external crates
104- Finding correct function signatures
105- Getting usage examples
106- Understanding library patterns
107- Checking latest API changes
108
109**Use mode="code" when:**
110- Need function signatures
111- Want code examples
112- Looking for API reference
113- Implementing features
114
115**Use mode="info" when:**
116- Understanding architecture
117- Learning concepts
118- Reading guides
119- Design decisions
120
121## Integration with Development
122
123### Before Implementation
1241. Resolve library ID for relevant crates
1252. Fetch documentation for the specific API you'll use
1263. Check examples for correct usage patterns
127
128### During Debugging
1291. Fetch docs for error types
1302. Look up correct parameter types
1313. Find working examples
132
133### Example Workflow
134
135Task: Implement async HTTP client with reqwest
136
137```
1381. resolve-library-id: "reqwest"
139 -> Returns: "/seanmonstar/reqwest"
140
1412. get-library-docs:
142 context7CompatibleLibraryID: "/seanmonstar/reqwest"
143 topic: "client"
144 mode: "code"
145 -> Returns: Client builder patterns, request methods
146
1473. get-library-docs:
148 context7CompatibleLibraryID: "/seanmonstar/reqwest"
149 topic: "error handling"
150 mode: "code"
151 -> Returns: Error types, retry patterns
152```
153
154## Tips
155
156- Be specific with topics for better results
157- Use page parameter if first page doesn't have what you need
158- Combine mode="info" for understanding + mode="code" for implementation
159- Cache library IDs mentally for frequently used crates
160- Check multiple topics if needed (e.g., "client" then "request builder")
161
162## Common Rust Ecosystem Lookups
163
164| Crate | Common Topics |
165|-------|---------------|
166| tokio | spawn, select, channel, time, sync |
167| serde | derive, serialize, deserialize, attributes |
168| axum | router, handler, extractor, middleware |
169| sqlx | query, pool, transaction, migrate |
170| tracing | span, event, subscriber, instrument |
171| anyhow | context, bail, ensure |
172| thiserror | error, from, source |
173| clap | parser, derive, subcommand, arg |
174| reqwest | client, request, response, error |
175| hyper | server, client, body |