Skip to main content
Glama

get_fulfillment_order

Fetch a fulfillment order by GID with complete line-item details and remaining quantities. Use this when you have the FulfillmentOrder ID directly, such as from a webhook, to obtain detailed information without querying the parent order.

Instructions

Fetch a single fulfillment order by GID with its full line-item set and remaining quantities. Use this when you have the FulfillmentOrder ID directly (e.g. from a webhook payload) and want detail without having to look up its parent order first. Returns the same shape as list_fulfillment_orders for one record.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesFulfillmentOrder GID.

Implementation Reference

  • The 'get_fulfillment_order' tool handler. It executes a GraphQL query (GET_FULFILLMENT_ORDER_QUERY) using the provided fulfillment order GID, and formats the response using summarizeFulfillmentOrder(). Registered via server.tool() with the name 'get_fulfillment_order'.
    server.tool(
      "get_fulfillment_order",
      "Fetch a single fulfillment order by GID with its full line-item set and remaining quantities. Use this when you have the FulfillmentOrder ID directly (e.g. from a webhook payload) and want detail without having to look up its parent order first. Returns the same shape as list_fulfillment_orders for one record.",
      getFulfillmentOrderSchema,
      async (args) => {
        const data = await client.graphql<{
          fulfillmentOrder: FulfillmentOrderNode | null;
        }>(GET_FULFILLMENT_ORDER_QUERY, { id: args.id });
        if (!data.fulfillmentOrder) {
          return {
            content: [
              { type: "text" as const, text: `Fulfillment order not found: ${args.id}` },
            ],
          };
        }
        return {
          content: [
            {
              type: "text" as const,
              text: summarizeFulfillmentOrder(data.fulfillmentOrder).join("\n"),
            },
          ],
        };
      },
  • The input schema for get_fulfillment_order. It defines a single required parameter 'id' of type string (a FulfillmentOrder GID).
    const getFulfillmentOrderSchema = {
      id: z.string().describe("FulfillmentOrder GID."),
    };
  • The GraphQL query used by get_fulfillment_order. It fetches a fulfillment order by ID including status, requestStatus, assignedLocation, destination, lineItems (up to 100), and createdAt.
    const GET_FULFILLMENT_ORDER_QUERY = /* GraphQL */ `
      query GetFulfillmentOrder($id: ID!) {
        fulfillmentOrder(id: $id) {
          id
          status
          requestStatus
          assignedLocation { name location { id } }
          destination { address1 city countryCode zip }
          lineItems(first: 100) {
            edges {
              node {
                id
                totalQuantity
                remainingQuantity
                lineItem { id title sku }
              }
            }
            pageInfo { hasNextPage }
          }
          createdAt
        }
      }
    `;
  • The summarizeFulfillmentOrder helper function used by the handler to format the fulfillment order data into human-readable text.
    function summarizeFulfillmentOrder(fo: FulfillmentOrderNode): string[] {
      const lines: string[] = [
        `  ${fo.id} [${fo.status}/${fo.requestStatus}] at ${fo.assignedLocation.name}`,
      ];
      if (fo.destination) {
        const d = fo.destination;
        lines.push(
          `    ship to: ${[d.address1, d.city, d.zip, d.countryCode].filter(Boolean).join(", ") || "(no address)"}`,
        );
      }
      for (const edge of fo.lineItems.edges) {
        const li = edge.node;
        lines.push(
          `    - ${li.lineItem.title}${li.lineItem.sku ? ` (SKU ${li.lineItem.sku})` : ""} — ${li.remainingQuantity}/${li.totalQuantity} remaining — ${li.id}`,
        );
      }
      if (fo.lineItems.pageInfo.hasNextPage) {
        lines.push("    (more line items available)");
      }
      return lines;
    }
  • src/server.ts:65-70 (registration)
    Registration of the fulfillment tools (including get_fulfillment_order) via registerFulfillmentTools(s, shopify) in the server's buildServer function.
    registerFulfillmentTools(s, shopify);
    registerWebhookTools(s, shopify);
    registerMetaobjectTools(s, shopify);
    registerAnalyticsTools(s, shopify);
    registerBridgeTools(s, shopify, comfyui, config.comfyUIDefaultCkpt);
    return s;
Behavior3/5

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

No annotations provided, so description carries full burden. It describes return content but does not mention read-only nature, permissions, or error handling. Adequate but not thorough.

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 action and result, then usage guidance, then return format. No unnecessary words.

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

Completeness4/5

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

Given no output schema, description explains return shape (same as list_fulfillment_orders) and includes line-item detail. Lacks potential error info but sufficient for a simple fetch tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema has one parameter with basic description; description adds context: 'by GID' and typical source (webhook), adding value beyond schema. Schema coverage is 100%, baseline 3, but description elevates it.

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?

Clearly states it fetches a single fulfillment order by GID, with full line-item set and remaining quantities. Differentiates from sibling list_fulfillment_orders by specifying it returns a single record.

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?

Explicitly recommends use when FulfillmentOrder ID is known directly (e.g., from webhook) and highlights efficiency over looking up parent order. Does not explicitly state when not to use, but context is clear.

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