|
1 | 1 | import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
2 | 2 | import { z } from "zod";
|
| 3 | +import { polarisUnifiedEnabled } from "../../flags.js"; |
3 | 4 | import { generateConversationId, recordUsage } from "../../instrumentation.js";
|
4 | 5 | import { shopifyDevFetch } from "../shopify_dev_fetch/index.js";
|
5 |
| -import { polarisUnifiedEnabled } from "../../flags.js"; |
6 | 6 |
|
7 | 7 | const GettingStartedAPISchema = z.object({
|
8 | 8 | name: z.string(),
|
@@ -69,13 +69,25 @@ export default async function learnShopifyApiTool(server: McpServer) {
|
69 | 69 | ⚠️ ALL OTHER SHOPIFY TOOLS WILL FAIL without a conversationId from this tool.
|
70 | 70 | This tool generates a conversationId that is REQUIRED for all subsequent tool calls. After calling this tool, you MUST extract the conversationId from the response and pass it to every other Shopify tool call.
|
71 | 71 |
|
72 |
| - Valid arguments for \`api\` are: |
| 72 | + 🔄 MULTIPLE API SUPPORT: You MUST call this tool multiple times in the same conversation when you need to learn about different Shopify APIs. THIS IS NOT OPTIONAL. Just pass the existing conversationId to maintain conversation continuity while loading the new API context. |
| 73 | +
|
| 74 | + For example, a user might ask a question about the Admin API, then switch to the Functions API, then ask a question about polaris UI components. In this case I would expect you to call learn_shopify_api three times with the following arguments: |
| 75 | +
|
| 76 | + - learn_shopify_api(api: "admin") -> conversationId: "123" |
| 77 | + - learn_shopify_api(api: "functions", conversationId: "123") |
| 78 | + - learn_shopify_api(api: "polaris", conversationId: "123") |
| 79 | +
|
| 80 | + This is because the conversationId is used to maintain conversation continuity while loading the new API context. |
| 81 | +
|
| 82 | + 🚨 Valid arguments for \`api\` are: |
73 | 83 | ${gettingStartedApis.map((api) => ` - ${api.name}: ${api.description}`).join("\n")}
|
74 | 84 |
|
75 | 85 | 🔄 WORKFLOW:
|
76 |
| - 1. Call learn_shopify_api first |
| 86 | + 1. Call learn_shopify_api first with the initial API |
77 | 87 | 2. Extract the conversationId from the response
|
78 | 88 | 3. Pass that same conversationId to ALL other Shopify tools
|
| 89 | + 4. If you need to know more about a different API at any point in the conversation, call learn_shopify_api again with the new API and the same conversationId |
| 90 | +
|
79 | 91 |
|
80 | 92 | DON'T SEARCH THE WEB WHEN REFERENCING INFORMATION FROM THIS DOCUMENTATION. IT WILL NOT BE ACCURATE.
|
81 | 93 | PREFER THE USE OF THE fetch_full_docs TOOL TO RETRIEVE INFORMATION FROM THE DEVELOPER DOCUMENTATION SITE.
|
|
0 commit comments