Skip to main content
Glama

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; }

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