scp_create_intent
Create shopping intents with authorized merchants to define customer purchase goals and enable personalized shopping assistance through the Shopper Context Protocol.
Instructions
Create a new shopping intent with a merchant. Domain must be authorized with intent:create scope.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ai_assistant | No | Name of the AI assistant | |
| base_intent | Yes | Natural language description of the shopping goal | |
| context | No | Additional context about the intent | |
| domain | Yes | Merchant domain | |
| mechanism | No | How the intent was created | conversational_ai |
| visibility | No | Who can see this intent | merchant_only |
Implementation Reference
- src/server.ts:933-957 (handler)The main handler function for the 'scp_create_intent' MCP tool. It validates authorization, retrieves the access token, constructs the request parameters, calls the SCP HTTP client to create the intent, and returns the result.* Tool handler: scp_create_intent */ async function handleCreateIntent(domain: string, params: any) { const { auth, accessToken } = await checkAuthorizationOrThrow(domain); const token = await accessToken; const data = await scpClient.createIntent(auth.scp_endpoint, token, { base_intent: params.base_intent, mechanism: params.mechanism || 'conversational_ai', ai_assistant: params.ai_assistant, ai_session_id: params.ai_session_id, context: params.context, visibility: params.visibility || 'merchant_only', expires_at: params.expires_at }); return { content: [ { type: 'text', text: JSON.stringify(data, null, 2) } ] }; }
- src/server.ts:470-506 (schema)The input schema definition and description for the 'scp_create_intent' tool, registered in the ListTools response.{ name: 'scp_create_intent', description: 'Create a new shopping intent with a merchant. Domain must be authorized with intent:create scope.', inputSchema: { type: 'object', properties: { domain: { type: 'string', description: 'Merchant domain' }, base_intent: { type: 'string', description: 'Natural language description of the shopping goal' }, context: { type: 'object', description: 'Additional context about the intent' }, mechanism: { type: 'string', description: 'How the intent was created', default: 'conversational_ai' }, ai_assistant: { type: 'string', description: 'Name of the AI assistant' }, visibility: { type: 'string', description: 'Who can see this intent', enum: ['merchant_only', 'shared_with_customer'], default: 'merchant_only' } }, required: ['domain', 'base_intent'] } },
- src/server.ts:576-577 (registration)The switch case in the CallToolRequestSchema handler that routes calls to the scp_create_intent tool to its handler function.case 'scp_create_intent': return await handleCreateIntent(args.domain as string, args);