scp_update_intent
Modify existing shopping intent status, context, or milestones for authorized merchant domains to track and update customer purchase journeys.
Instructions
Update an existing shopping intent. Domain must be authorized with intent:write scope.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| add_milestone | No | Add a milestone note | |
| context | No | Updated context | |
| domain | Yes | Merchant domain | |
| intent_id | Yes | Intent ID to update | |
| status | No | New status |
Implementation Reference
- src/server.ts:962-987 (handler)The handler function that implements the core logic for the 'scp_update_intent' MCP tool. It checks authorization, retrieves a valid access token, and makes an RPC request to the merchant's SCP endpoint to update the intent.async function handleUpdateIntent(domain: string, params: any) { const { auth, accessToken } = await checkAuthorizationOrThrow(domain); const token = await accessToken; // Need to implement updateIntent in http/client.ts const data = await scpClient.makeRPCRequest( auth.scp_endpoint, token, 'scp.update_intent', { intent_id: params.intent_id, status: params.status, context: params.context, add_milestone: params.add_milestone } ); return { content: [ { type: 'text', text: JSON.stringify(data, null, 2) } ] }; }
- src/server.ts:507-536 (schema)The input schema definition for the 'scp_update_intent' tool, registered in the ListToolsRequestSchema handler.{ name: 'scp_update_intent', description: 'Update an existing shopping intent. Domain must be authorized with intent:write scope.', inputSchema: { type: 'object', properties: { domain: { type: 'string', description: 'Merchant domain' }, intent_id: { type: 'string', description: 'Intent ID to update' }, status: { type: 'string', description: 'New status' }, context: { type: 'object', description: 'Updated context' }, add_milestone: { type: 'string', description: 'Add a milestone note' } }, required: ['domain', 'intent_id'] } }
- src/server.ts:579-580 (registration)The switch case in the CallToolRequestSchema handler that routes calls to the 'scp_update_intent' tool to its handler function.case 'scp_update_intent': return await handleUpdateIntent(args.domain as string, args);
- src/server.ts:811-825 (helper)Helper function used by the handler (and others) to check authorization and throw a helpful error if not authorized.async function checkAuthorizationOrThrow(domain: string): Promise<{ auth: any; accessToken: Promise<string> }> { const auth = await getAuthorization(domain); if (!auth) { const errorMessage = `❌ Not authorized with ${domain}.\n\n` + `Please authorize first by calling:\n` + `scp_authorize with domain="${domain}", email="your@email.com", and scopes=["orders", "loyalty", "preferences", "intent:read", "intent:create"]`; throw new Error(errorMessage); } return { auth, accessToken: getValidAccessToken(domain) }; }