Skip to main content
Glama
clavia-labs

Shopify Update MCP Server

by clavia-labs

get-order

Retrieve a specific Shopify order by its ID to view details, track status, or process updates within the Shopify Update MCP Server.

Instructions

Get a single order by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
orderIdYesID of the order to retrieve

Implementation Reference

  • src/index.ts:348-369 (registration)
    Registration of the 'get-order' MCP tool, including input schema (orderId: string) and inline handler that uses ShopifyClient.loadOrder to fetch and return the order as JSON.
    server.tool(
      "get-order",
      "Get a single order by ID",
      {
        orderId: z.string().describe("ID of the order to retrieve"),
      },
      async ({ orderId }) => {
        const client = new ShopifyClient();
        try {
          const order = await client.loadOrder(
            SHOPIFY_ACCESS_TOKEN,
            MYSHOPIFY_DOMAIN,
            { orderId }
          );
          return {
            content: [{ type: "text", text: JSON.stringify(order, null, 2) }],
          };
        } catch (error) {
          return handleError("Failed to retrieve order", error);
        }
      }
    );
  • The handler function executes the tool logic: instantiates ShopifyClient, calls loadOrder with access token, shop domain, and orderId, returns formatted JSON response or error.
    async ({ orderId }) => {
      const client = new ShopifyClient();
      try {
        const order = await client.loadOrder(
          SHOPIFY_ACCESS_TOKEN,
          MYSHOPIFY_DOMAIN,
          { orderId }
        );
        return {
          content: [{ type: "text", text: JSON.stringify(order, null, 2) }],
        };
      } catch (error) {
        return handleError("Failed to retrieve order", error);
      }
    }
  • Zod input schema for the tool: requires orderId as string.
    {
      orderId: z.string().describe("ID of the order to retrieve"),
    },
  • Core helper method loadOrder that performs a GET request to Shopify Admin API to retrieve the specific order by ID, optionally specifying fields.
    async loadOrder(
      accessToken: string,
      shop: string,
      queryParams: ShopifyLoadOrderQueryParams
    ): Promise<ShopifyOrder> {
      const res = await this.shopifyHTTPRequest<{ order: ShopifyOrder }>({
        method: "GET",
        url: `https://${shop}/admin/api/${this.SHOPIFY_API_VERSION}/orders/${queryParams.orderId}.json`,
        accessToken,
        params: {
          fields: this.getOrdersFields(queryParams.fields),
        },
      });
    
      return res.data.order;
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

C2.9/5.0
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 retrieves an order but fails to describe key behaviors: whether it's a read-only operation, what happens if the order ID is invalid (e.g., error handling), or any rate limits or authentication requirements. This leaves significant gaps in understanding how the tool behaves in practice.

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 and front-loaded, consisting of a single, clear sentence that directly states the tool's purpose. There is no wasted verbiage, and it efficiently communicates the core functionality without unnecessary elaboration.

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 retrieval tool. It doesn't explain what is returned (e.g., order details, error formats) or address behavioral aspects like error conditions. While the purpose is clear, the overall context for effective tool use is insufficient.

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%, with the single parameter 'orderId' fully documented in the schema as 'ID of the order to retrieve'. The description adds no additional semantic context beyond implying the parameter is required for retrieval, so it meets the baseline score without compensating for or enhancing the schema information.

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') and resource ('a single order by ID'), making the purpose immediately understandable. It distinguishes this from sibling tools like 'get-orders' (plural) by specifying retrieval of a single order, though it doesn't explicitly contrast with other sibling tools beyond this implicit differentiation.

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 like 'get-orders' or other retrieval tools. It lacks context about prerequisites, such as needing an existing order ID, and offers no explicit when-not-to-use or alternative recommendations, leaving usage decisions to inference.

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