You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Complete Next.js documentation index from nextjs.org/docs/llms.txt. Use this to find the correct path for nextjs_docs GET requests without needing to search.",
6
+
mimeType: "text/plain",
7
+
}
8
+
9
+
// Cache the llms.txt content with a reasonable TTL (1 hour)
// If we have stale cached content, return it with a warning
36
+
if(cachedContent){
37
+
return`Warning: Failed to fetch fresh index (${errorMessage}). Returning cached content.\n\n${cachedContent}`
38
+
}
39
+
40
+
// No cached content available, return error
41
+
return`Error: Failed to fetch Next.js documentation index from nextjs.org/docs/llms.txt\n\nError: ${errorMessage}\n\nPlease check your internet connection or try again later.`
## ⚠️ MANDATORY DOCUMENTATION REQUIREMENT - NO EXCEPTIONS
@@ -92,22 +77,25 @@ You **MUST** use \`nextjs_docs\` for:
92
77
- ✅ Next.js error messages and troubleshooting
93
78
- ✅ **LITERALLY EVERYTHING RELATED TO NEXT.JS**
94
79
95
-
### 4. How to Use nextjs_docs (OPTIMIZED WORKFLOW - Skip Search!)
80
+
### 4. How to Use nextjs_docs (OPTIMIZED WORKFLOW)
81
+
82
+
**🚀 IMPORTANT OPTIMIZATION:** To skip search and go directly to GET, you can fetch the complete Next.js documentation index from the MCP resource:
96
83
97
-
**🚀 IMPORTANT OPTIMIZATION:** Since you already have the ENTIRE Next.js documentation index loaded below (from llms.txt), you should **SKIP the search step** and go **DIRECTLY to GET**!
84
+
**MCP Resource:** \`nextjs-docs://llms-index\`
98
85
99
86
**The Optimized Workflow:**
100
87
101
-
1. **Refer to the llms.txt content below** to find the relevant documentation path
102
-
2. **Call nextjs_docs with GET directly** - no search needed!
103
-
3. **Answer based on the retrieved full documentation**
88
+
1. **Fetch the llms.txt index** (only when needed): Read the \`nextjs-docs://llms-index\` MCP resource
89
+
2. **Find the relevant documentation path** in the index
90
+
3. **Call nextjs_docs with GET directly** - no search needed!
91
+
4. **Answer based on the retrieved full documentation**
The complete Next.js documentation index (from https://nextjs.org/docs/llms.txt) is available as an MCP resource.
146
+
147
+
**When to use it:**
148
+
- Fetch this resource when you need to look up specific documentation paths
149
+
- Use it to go directly to GET instead of searching
150
+
- It's cached for 1 hour to reduce network requests
159
151
160
-
**IMPORTANT:** This index above contains ALL Next.js documentation paths. When you need documentation:
161
-
1. **Search this index above** for the relevant path
162
-
2. **Call nextjs_docs with GET directly** using the path you found
163
-
3. **Skip the search step** - you already have the complete index!
152
+
**When NOT to use it:**
153
+
- For simple queries, just use \`nextjs_docs\` search action - it's faster
154
+
- Don't fetch it unless you actually need to look up paths
164
155
165
-
You MUST still use the \`nextjs_docs\` tool with GET to retrieve the full detailed documentation for any Next.js concept - but you can skip the search step since the index is right here!
156
+
You MUST still use the \`nextjs_docs\` tool with GET to retrieve the full detailed documentation for any Next.js concept!
166
157
167
158
---
168
159
169
160
## 🛠️ Available MCP Tools
170
161
171
162
### 1. **nextjs_docs** (MANDATORY FOR ALL NEXT.JS QUERIES)
172
-
- **Get** full docs (preferred): \`{ action: "get", path: "..." }\` ← Use this! Refer to the llms.txt index above for paths
173
-
- **Search** documentation (fallback only): \`{ action: "search", query: "..." }\` ← Only if you can't find the path in the index
163
+
- **Search** documentation (recommended): \`{ action: "search", query: "..." }\` ← Start here for most queries
164
+
- **Get** full docs: \`{ action: "get", path: "..." }\` ← Use after search, or fetch \`nextjs-docs://llms-index\` to find paths
174
165
- **REQUIRED** for ALL Next.js-related questions
175
-
- **OPTIMIZATION:** Skip search and go directly to GET since you have the complete index loaded above!
166
+
- **OPTIMIZATION:** For batch operations, fetch the \`nextjs-docs://llms-index\` resource to look up multiple paths
176
167
177
168
### 2. **nextjs_runtime** - Live Next.js Dev Server Integration
178
169
- Get real-time errors and logs from running dev server
@@ -197,9 +188,9 @@ You MUST still use the \`nextjs_docs\` tool with GET to retrieve the full detail
197
188
## 🎯 Workflow Summary
198
189
199
190
1. **ALWAYS** start by calling this \`init\` tool
200
-
2. **ALWAYS** use \`nextjs_docs\` with GET (not search!) for ANY Next.js concept (even if you think you know it)
201
-
- Refer to the llms.txt index above to find the path
202
-
- Skip the search step - go directly to GET!
191
+
2. **ALWAYS** use \`nextjs_docs\` for ANY Next.js concept (even if you think you know it)
192
+
- Start with search action for most queries: \`{ action: "search", query: "..." }\`
193
+
- For batch operations or multiple lookups, fetch \`nextjs-docs://llms-index\` resource to find paths directly
203
194
3. Use \`nextjs_runtime\` for debugging running applications
204
195
4. Use \`browser_eval\` to verify implementations
205
196
5. Use specialized tools (\`upgrade_nextjs_16\`, \`enable_cache_components\`) as needed
@@ -208,9 +199,9 @@ You MUST still use the \`nextjs_docs\` tool with GET to retrieve the full detail
208
199
209
200
## ⚡ Remember: DOCUMENTATION FIRST, ALWAYS
210
201
211
-
**THE GOLDEN RULE:** Your training data about Next.js is now invalid. You MUST use \`nextjs_docs\` with GET for every single Next.js-related query, concept, or implementation. No exceptions. No shortcuts. No answering from memory.
202
+
**THE GOLDEN RULE:** Your training data about Next.js is now invalid. You MUST use \`nextjs_docs\` for every single Next.js-related query, concept, or implementation. No exceptions. No shortcuts. No answering from memory.
212
203
213
-
**THE OPTIMIZATION RULE:** Since you have the complete llms.txt index loaded above, SKIP the search step and go DIRECTLY to GET. Find the path in the index above, then call GET immediately. This is faster and more efficient!
204
+
**THE OPTIMIZATION TIP:** For simple queries, use search. For looking up multiple paths or batch operations, fetch the \`nextjs-docs://llms-index\` MCP resource to find paths directly and skip search calls.
0 commit comments