Skip to main content
Glama

get_order

Retrieve a complete order record by GID or numeric ID, including header fields, line items, and customer email, returned as JSON for downstream tooling. Requires prior use of list_orders to obtain the order identifier.

Instructions

Fetch a single order's full record by GID or numeric ID — includes header fields (email, totals, both status flags, timestamps), full line items (title + quantity), and the customer email if on file. Returned as JSON for downstream tooling. Use list_orders to discover order IDs first. To inspect or act on shipments for this order, follow up with list_fulfillment_orders.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesOrder GID ('gid://shopify/Order/123') or numeric ID — both forms accepted; numeric IDs are auto-promoted. Get one from list_orders.

Implementation Reference

  • The handler function for the 'get_order' tool. It executes the GraphQL GET_ORDER_QUERY, converts the input ID using toGid, handles the null case (order not found), and returns the order data as formatted JSON.
    async (args) => {
      const data = await client.graphql<{ order: Order | null }>(
        GET_ORDER_QUERY,
        { id: toGid(args.id, "Order") },
      );
      if (!data.order) {
        return {
          content: [{ type: "text" as const, text: `Order not found: ${args.id}` }],
        };
      }
      return {
        content: [{ type: "text" as const, text: JSON.stringify(data.order, null, 2) }],
      };
    },
  • Input schema for the 'get_order' tool. Defines a single 'id' parameter that accepts an Order GID or numeric ID, with a description explaining both forms are accepted and numeric IDs are auto-promoted.
    const getOrderSchema = {
      id: z
        .string()
        .describe(
          "Order GID ('gid://shopify/Order/123') or numeric ID — both forms accepted; numeric IDs are auto-promoted. Get one from list_orders.",
        ),
    };
  • Registration of 'get_order' with the MCP server via server.tool(), including the tool name, description, schema, and handler. The getOrderSchema and GET_ORDER_QUERY are bound here.
    server.tool(
      "get_order",
      "Fetch a single order's full record by GID or numeric ID — includes header fields (email, totals, both status flags, timestamps), full line items (title + quantity), and the customer email if on file. Returned as JSON for downstream tooling. Use list_orders to discover order IDs first. To inspect or act on shipments for this order, follow up with list_fulfillment_orders.",
      getOrderSchema,
      async (args) => {
        const data = await client.graphql<{ order: Order | null }>(
          GET_ORDER_QUERY,
          { id: toGid(args.id, "Order") },
        );
        if (!data.order) {
          return {
            content: [{ type: "text" as const, text: `Order not found: ${args.id}` }],
          };
        }
        return {
          content: [{ type: "text" as const, text: JSON.stringify(data.order, null, 2) }],
        };
      },
    );
  • src/server.ts:58-58 (registration)
    Where registerOrderTools is called to register all order tools (including get_order) on the McpServer instance.
    registerOrderTools(s, shopify);
  • GraphQL query used by the get_order handler to fetch an order's details including id, name, email, status flags, totals, and line items.
    const GET_ORDER_QUERY = /* GraphQL */ `
      query GetOrder($id: ID!) {
        order(id: $id) {
          id
          name
          email
          displayFinancialStatus
          displayFulfillmentStatus
          totalPriceSet { shopMoney { amount currencyCode } }
          createdAt
          lineItems(first: 50) {
            edges { node { title quantity } }
          }
        }
      }
    `;
Behavior4/5

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

With no annotations, the description carries the burden. It states return format (JSON) and accepted ID forms, but could mention idempotency or error behavior. Still, it's adequate for a read-only fetch.

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?

Three concise sentences, front-loaded with the primary action and result, no redundant information. Every sentence adds value.

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

Completeness5/5

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

Given the single parameter and no output schema, the description fully explains what data is returned and provides usage context, making it complete for the tool's simplicity.

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?

Schema coverage is 100% and already describes the parameter well. The description adds minimal extra meaning beyond reinforcing GID/numeric ID acceptance and use of list_orders. Baseline 3 is appropriate.

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

Purpose5/5

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

The description clearly states the tool fetches a single order's full record, specifies included fields (header, line items, customer email), and distinguishes from siblings like list_orders and list_fulfillment_orders.

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

Usage Guidelines5/5

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

Explicitly advises to use list_orders to discover IDs first, and to follow up with list_fulfillment_orders for shipments. This provides clear when-to-use and alternatives.

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/miller-joe/shopify-mcp'

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