Skip to main content
Glama

scp_get_orders

Retrieve order history from authorized merchants to access purchase records, filter by status, and manage order data for customer service and analytics.

Instructions

Get order history from a merchant. Domain must be authorized first.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYesMerchant domain
limitNoMaximum number of orders to return
offsetNoNumber of orders to skip
statusNoFilter by order status (e.g., ['delivered', 'shipped'])

Implementation Reference

  • The MCP tool handler for scp_get_orders. Checks authorization, retrieves valid access token, calls SCP client to fetch orders, and returns JSON-formatted response.
     * Tool handler: scp_get_orders
     */
    async function handleGetOrders(domain: string, params: any) {
      const { auth, accessToken } = await checkAuthorizationOrThrow(domain);
      const token = await accessToken;
    
      const data = await scpClient.getOrders(auth.scp_endpoint, token, {
        limit: params.limit || 10,
        offset: params.offset || 0,
        status: params.status
      });
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(data, null, 2)
          }
        ]
      };
    }
  • Input schema and description for the scp_get_orders tool, defining parameters domain (required), limit, offset, status.
    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']
    }
  • src/server.ts:561-562 (registration)
    Tool handler registration in the CallToolRequestSchema switch statement dispatching to handleGetOrders.
    case 'scp_get_orders':
      return await handleGetOrders(args.domain as string, args);
  • Helper function that checks if authorized for the domain and returns auth info and access token promise, or throws detailed error.
    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 generic JSON-RPC request specifically for the 'scp.get_orders' method.
    export async function getOrders(
      endpoint: string,
      accessToken: string,
      params?: { limit?: number; offset?: number; status?: string[] }
    ): Promise<any> {
      return makeRPCRequest(endpoint, accessToken, 'scp.get_orders', params);
    }
Behavior3/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 mentions the authorization requirement, which is valuable context about access control. However, it doesn't describe other important behaviors like pagination handling (implied by limit/offset but not explained), rate limits, error conditions, or what format the order history returns. For a tool with 4 parameters and no output schema, more behavioral context would be helpful.

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

Conciseness5/5

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

The description is extremely concise with just two sentences that each serve a clear purpose: the first states the core functionality, and the second provides critical usage context. There's zero wasted language, and the most important information (what the tool does) comes first. This is an excellent example of efficient documentation.

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

Completeness3/5

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

Given the tool has 4 parameters, no annotations, and no output schema, the description provides adequate but incomplete context. The authorization prerequisite is valuable, but missing details about return format, pagination behavior, error handling, and rate limits leave gaps. For a data retrieval tool with filtering capabilities, more complete context would help the agent understand what to expect from the operation.

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 schema description coverage is 100%, so all parameters are well-documented in the schema itself. The description doesn't add any additional parameter information beyond what's already in the schema descriptions. It mentions the domain parameter indirectly through the authorization requirement, but this doesn't enhance the parameter semantics beyond the schema's documentation. The baseline score of 3 is appropriate when the schema does the heavy lifting.

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 action ('Get order history') and target resource ('from a merchant'), making the purpose immediately understandable. It distinguishes this tool from siblings like scp_get_intents or scp_get_offers by specifying it retrieves order data rather than other merchant information. However, it doesn't specify whether this returns all historical orders or recent ones, which could help further differentiate from potential future tools.

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

Usage Guidelines4/5

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

The description provides clear context about when to use this tool by stating 'Domain must be authorized first,' which references the scp_authorize sibling tool. This establishes a prerequisite relationship. However, it doesn't explicitly mention when NOT to use this tool or provide alternatives for similar queries, such as when to use scp_get_intents instead for different merchant data.

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