Skip to main content
Glama

scp_check_authorization

Verify authorization status for accessing customer e-commerce data from a specific merchant domain using OAuth 2.0 authentication.

Instructions

Check if authorized with a merchant domain

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYesMerchant domain

Implementation Reference

  • The primary handler function for the 'scp_check_authorization' tool. It checks the authorization status for a given merchant domain using getAuthorizationInfo and returns structured information about the authorization or indicates if not authorized.
    async function handleCheckAuthorization(domain: string) {
      const info = await getAuthorizationInfo(domain);
    
      if (!info.authorized) {
        return {
          content: [
            {
              type: 'text',
              text: `Not authorized with ${domain}`
            }
          ]
        };
      }
    
      const expiresDate = new Date(info.expires_at!).toISOString();
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              authorized: true,
              domain,
              customer_email: info.customer_email,
              scopes: info.scopes,
              authorized_at: new Date(info.authorized_at!).toISOString(),
              expires_at: expiresDate
            }, null, 2)
          }
        ]
      };
    }
  • The input schema definition for the 'scp_check_authorization' tool, specifying that it requires a 'domain' string parameter.
    {
      name: 'scp_check_authorization',
      description: 'Check if authorized with a merchant domain',
      inputSchema: {
        type: 'object',
        properties: {
          domain: {
            type: 'string',
            description: 'Merchant domain'
          }
        },
        required: ['domain']
      }
    },
  • src/server.ts:552-553 (registration)
    Registration of the tool handler in the CallToolRequestSchema switch statement, dispatching to handleCheckAuthorization.
    case 'scp_check_authorization':
      return await handleCheckAuthorization(args.domain as string);
  • src/server.ts:303-538 (registration)
    Registration of the tool in the ListToolsRequestSchema handler, including it in the list of available tools.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [
        {
          name: 'scp_authorize',
          description: 'BEFORE USING THIS ENSURE THE DOMAIN SUPPORTS SCP BY CALLING scp_discover FIRST. Authorize access to a merchant\'s customer context via SCP. Must be called before accessing any customer data. IMPORTANT: You must ask the user for their REAL email address - never use placeholder emails like user@example.com. Ask: "What email address do you use with [Merchant]?" and wait for their response.',
          inputSchema: {
            type: 'object',
            properties: {
              domain: {
                type: 'string',
                description: 'Merchant domain (e.g., \'acmestore.com\')'
              },
              email: {
                type: 'string',
                description: 'Customer\'s REAL email address (must ask user for this - never use example.com or placeholder emails)'
              },
              scopes: {
                type: 'array',
                items: { type: 'string' },
                description: 'Requested scopes (e.g., [\'orders\', \'loyalty\', \'intent:read\']). Best practice: request all needed scopes upfront.'
              }
            },
            required: ['domain', 'email', 'scopes']
          }
        },
        {
          name: 'scp_check_authorization',
          description: 'Check if authorized with a merchant domain',
          inputSchema: {
            type: 'object',
            properties: {
              domain: {
                type: 'string',
                description: 'Merchant domain'
              }
            },
            required: ['domain']
          }
        },
        {
          name: 'scp_revoke_authorization',
          description: 'Revoke authorization with a merchant domain',
          inputSchema: {
            type: 'object',
            properties: {
              domain: {
                type: 'string',
                description: 'Merchant domain'
              }
            },
            required: ['domain']
          }
        },
        {
          name: 'scp_discover',
          description: 'Discover SCP endpoint for a merchant domain via DNS',
          inputSchema: {
            type: 'object',
            properties: {
              domain: {
                type: 'string',
                description: 'Merchant domain'
              }
            },
            required: ['domain']
          }
        },
        {
          name: 'scp_get_orders',
          description: 'Get order history from a merchant. Domain must be authorized first.',
          inputSchema: {
            type: 'object',
            properties: {
              domain: {
                type: 'string',
                description: 'Merchant domain'
              },
              limit: {
                type: 'number',
                description: 'Maximum number of orders to return',
                default: 10
              },
              offset: {
                type: 'number',
                description: 'Number of orders to skip',
                default: 0
              },
              status: {
                type: 'array',
                items: { type: 'string' },
                description: 'Filter by order status (e.g., [\'delivered\', \'shipped\'])'
              }
            },
            required: ['domain']
          }
        },
        {
          name: 'scp_get_loyalty',
          description: 'Get loyalty status and points from a merchant. Domain must be authorized first.',
          inputSchema: {
            type: 'object',
            properties: {
              domain: {
                type: 'string',
                description: 'Merchant domain'
              }
            },
            required: ['domain']
          }
        },
        {
          name: 'scp_get_offers',
          description: 'Get active personalized offers from a merchant. Domain must be authorized first.',
          inputSchema: {
            type: 'object',
            properties: {
              domain: {
                type: 'string',
                description: 'Merchant domain'
              },
              active_only: {
                type: 'boolean',
                description: 'Only return active offers',
                default: true
              }
            },
            required: ['domain']
          }
        },
        {
          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']
          }
        },
        {
          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']
          }
        },
        {
          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']
          }
        },
        {
          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']
          }
        }
      ]
    }));
  • Helper function getAuthorizationInfo used by the tool handler to retrieve authorization details without exposing tokens.
    export async function getAuthorizationInfo(merchantDomain: string): Promise<{
      authorized: boolean;
      customer_email?: string;
      customer_id?: string;
      scopes?: string[];
      authorized_at?: number;
      expires_at?: number;
    }> {
      const auth = await getAuthorization(merchantDomain);
    
      if (!auth) {
        return { authorized: false };
      }
    
      return {
        authorized: true,
        customer_email: auth.customer_email,
        customer_id: auth.customer_id,
        scopes: auth.scopes,
        authorized_at: auth.created_at,
        expires_at: auth.expires_at
      };
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool checks authorization status but does not explain what 'authorized' entails, such as required permissions, authentication methods, or the response format. This leaves significant gaps in understanding the tool's behavior, warranting a score of 2.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence: 'Check if authorized with a merchant domain.' It is front-loaded and wastes no words, making it easy to parse. However, it could be slightly more informative without sacrificing brevity, so it scores a 4.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete for a tool that checks authorization status. It does not explain what 'authorized' means in this context, the expected return values, or error conditions. For a tool with potential security implications, this is inadequate, resulting in a score of 2.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the 'domain' parameter clearly documented as 'Merchant domain.' The description adds no additional meaning beyond this, as it does not elaborate on the parameter's usage or constraints. Given the high schema coverage, the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Check if authorized with a merchant domain.' It specifies the verb ('Check') and resource ('authorized with a merchant domain'), making the action understandable. However, it does not differentiate this tool from siblings like 'scp_authorize' or 'scp_revoke_authorization,' which limits its score to 4.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It does not mention prerequisites, such as needing prior authorization, or suggest when to choose it over siblings like 'scp_authorize' for authorization actions. This lack of contextual direction results in a score of 2.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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