scp_get_preferences
Retrieve saved customer preferences including sizes, styles, and addresses from authorized merchants to personalize shopping experiences.
Instructions
Get saved customer preferences (sizes, styles, addresses) from a merchant. Domain must be authorized first.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| domain | Yes | Merchant domain |
Implementation Reference
- src/server.ts:893-907 (handler)The primary MCP tool handler for scp_get_preferences. Checks authorization, retrieves valid access token, calls the HTTP client to fetch preferences via JSON-RPC, and returns the result as formatted text.async function handleGetPreferences(domain: string) { const { auth, accessToken } = await checkAuthorizationOrThrow(domain); const token = await accessToken; const data = await scpClient.getPreferences(auth.scp_endpoint, token); return { content: [ { type: 'text', text: JSON.stringify(data, null, 2) } ] }; }
- src/server.ts:432-445 (registration)Tool registration in the ListTools response, including name, description, and input schema.{ name: 'scp_get_preferences', description: 'Get saved customer preferences (sizes, styles, addresses) from a merchant. Domain must be authorized first.', inputSchema: { type: 'object', properties: { domain: { type: 'string', description: 'Merchant domain' } }, required: ['domain'] } },
- src/server.ts:435-444 (schema)Input schema definition for the scp_get_preferences tool, specifying the required 'domain' parameter.inputSchema: { type: 'object', properties: { domain: { type: 'string', description: 'Merchant domain' } }, required: ['domain'] }
- src/http/client.ts:117-122 (helper)Helper function in HTTP client that wraps the JSON-RPC call to the merchant's scp.get_preferences endpoint.export async function getPreferences( endpoint: string, accessToken: string ): Promise<any> { return makeRPCRequest(endpoint, accessToken, 'scp.get_preferences'); }