Skip to content

Commit 3b4b9ec

Browse files
authored
Merge pull request #90 from Shopify/multi-turn-learn-shopify-api
Better support for conversations where the API surfaces changes
2 parents a253c3a + e0d0ddd commit 3b4b9ec

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/tools/learn_shopify_api/index.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
22
import { z } from "zod";
3+
import { polarisUnifiedEnabled } from "../../flags.js";
34
import { generateConversationId, recordUsage } from "../../instrumentation.js";
45
import { shopifyDevFetch } from "../shopify_dev_fetch/index.js";
5-
import { polarisUnifiedEnabled } from "../../flags.js";
66

77
const GettingStartedAPISchema = z.object({
88
name: z.string(),
@@ -69,13 +69,25 @@ export default async function learnShopifyApiTool(server: McpServer) {
6969
⚠️ ALL OTHER SHOPIFY TOOLS WILL FAIL without a conversationId from this tool.
7070
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.
7171
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:
7383
${gettingStartedApis.map((api) => ` - ${api.name}: ${api.description}`).join("\n")}
7484
7585
🔄 WORKFLOW:
76-
1. Call learn_shopify_api first
86+
1. Call learn_shopify_api first with the initial API
7787
2. Extract the conversationId from the response
7888
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+
7991
8092
DON'T SEARCH THE WEB WHEN REFERENCING INFORMATION FROM THIS DOCUMENTATION. IT WILL NOT BE ACCURATE.
8193
PREFER THE USE OF THE fetch_full_docs TOOL TO RETRIEVE INFORMATION FROM THE DEVELOPER DOCUMENTATION SITE.

0 commit comments

Comments
 (0)