Skip to main content
Glama

scp_get_intents

Retrieve shopping intents from authorized merchant domains to understand customer purchase goals and preferences for personalized e-commerce assistance.

Instructions

Get shopping intents from a merchant. Domain must be authorized first.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYesMerchant domain
limitNoMaximum number of intents to return
statusNoFilter by status (e.g., ['active', 'in_progress'])

Implementation Reference

  • Main execution handler for scp_get_intents tool. Checks authorization, fetches access token, calls SCP client to retrieve shopping intents, and returns JSON-formatted response.
    async function handleGetIntents(domain: string, params: any) {
      const { auth, accessToken } = await checkAuthorizationOrThrow(domain);
      const token = await accessToken;
    
      const data = await scpClient.getIntents(auth.scp_endpoint, token, {
        status: params.status || ['active', 'in_progress'],
        limit: params.limit || 10,
        offset: params.offset || 0
      });
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(data, null, 2)
          }
        ]
      };
    }
  • Input schema and metadata for the scp_get_intents tool, defining required 'domain' and optional 'status' and 'limit' parameters.
    {
      name: 'scp_get_intents',
      description: 'Get shopping intents from a merchant. Domain must be authorized first.',
      inputSchema: {
        type: 'object',
        properties: {
          domain: {
            type: 'string',
            description: 'Merchant domain'
          },
          status: {
            type: 'array',
            items: { type: 'string' },
            description: 'Filter by status (e.g., [\'active\', \'in_progress\'])'
          },
          limit: {
            type: 'number',
            description: 'Maximum number of intents to return',
            default: 10
          }
        },
        required: ['domain']
      }
    },
  • src/server.ts:573-575 (registration)
    Tool handler registration in the CallToolRequestSchema switch statement, mapping tool name to handleGetIntents function.
    case 'scp_get_intents':
      return await handleGetIntents(args.domain as string, args);
  • Shared authorization check helper function used by the handler to ensure the domain is authorized before accessing data.
    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)
      };
    }
  • HTTP client helper that wraps the JSON-RPC call to the merchant's SCP endpoint for fetching intents.
    export async function getIntents(
      endpoint: string,
      accessToken: string,
      params?: {
        status?: string[];
        mechanism?: string;
        limit?: number;
        offset?: number;
      }
    ): Promise<any> {
      return makeRPCRequest(endpoint, accessToken, 'scp.get_intents', params);
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/shopper-context-protocol/scp-mcp-wrapper'

If you have feedback or need assistance with the MCP directory API, please join our Discord server