Skip to main content
Glama

get-order

Retrieve a specific Shopify order by its unique ID using the 'get-order' tool. Simplify order management and access detailed order information directly from 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 inline handler function that delegates to ShopifyClient.loadOrder
    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); } } );
  • Handler function for the 'get-order' tool: creates ShopifyClient instance, calls loadOrder with credentials and orderId, returns JSON stringified order or handles 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 schema for 'get-order' tool input: requires orderId as string
    { orderId: z.string().describe("ID of the order to retrieve"), },
  • Core implementation of loading a single order via Shopify REST API GET request to /orders/{orderId}.json, using shopifyHTTPRequest helper
    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; }
  • TypeScript type definition for loadOrder query parameters used by the tool's underlying helper
    export type ShopifyLoadOrderQueryParams = { orderId: string; fields?: string[]; };

Other Tools

Related 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/smithery-ai/shopify-mcp-server-main-1'

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