Skip to main content
Glama

get_fulfillment

Retrieve fulfillment details by GID to confirm shipment status, view tracking info, and access related order data. Use after creating a fulfillment or when receiving a fulfillment GID from webhooks.

Instructions

Fetch a single fulfillment (a shipment record produced by create_fulfillment) by GID. Returns its status (SUCCESS/CANCELLED/etc.), tracking entries (carrier, number, URL), the parent order, and timestamps. Use after create_fulfillment to confirm the shipment took, or when a webhook delivers a fulfillment GID and you need the details.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesFulfillment GID.

Implementation Reference

  • Registration of 'get_fulfillment' tool via server.tool() with the schema and handler.
    server.tool(
      "get_fulfillment",
      "Fetch a single fulfillment (a shipment record produced by create_fulfillment) by GID. Returns its status (SUCCESS/CANCELLED/etc.), tracking entries (carrier, number, URL), the parent order, and timestamps. Use after create_fulfillment to confirm the shipment took, or when a webhook delivers a fulfillment GID and you need the details.",
      getFulfillmentSchema,
      async (args) => {
        const data = await client.graphql<{ fulfillment: FulfillmentNode | null }>(
          GET_FULFILLMENT_QUERY,
          { id: args.id },
        );
        if (!data.fulfillment) {
          return {
            content: [
              { type: "text" as const, text: `Fulfillment not found: ${args.id}` },
            ],
          };
        }
        const f = data.fulfillment;
        const tracking = f.trackingInfo
          .map((t) => {
            const parts = [t.company, t.number, t.url].filter(Boolean);
            return parts.length > 0 ? `    - ${parts.join(" | ")}` : "    - (empty)";
          })
          .join("\n");
        return {
          content: [
            {
              type: "text" as const,
              text: [
                `${f.name} [${f.status}]`,
                `  ID: ${f.id}`,
                f.order ? `  Order: ${f.order.name} (${f.order.id})` : "",
                f.totalQuantity !== null && f.totalQuantity !== undefined
                  ? `  Total quantity: ${f.totalQuantity}`
                  : "",
                "  Tracking:",
                tracking || "    (none)",
                `  Created: ${f.createdAt}`,
                `  Updated: ${f.updatedAt}`,
              ]
                .filter(Boolean)
                .join("\n"),
            },
          ],
        };
      },
    );
  • Handler function that calls GraphQL query GET_FULFILLMENT_QUERY and formats the response (status, tracking, order, timestamps).
    async (args) => {
      const data = await client.graphql<{ fulfillment: FulfillmentNode | null }>(
        GET_FULFILLMENT_QUERY,
        { id: args.id },
      );
      if (!data.fulfillment) {
        return {
          content: [
            { type: "text" as const, text: `Fulfillment not found: ${args.id}` },
          ],
        };
      }
      const f = data.fulfillment;
      const tracking = f.trackingInfo
        .map((t) => {
          const parts = [t.company, t.number, t.url].filter(Boolean);
          return parts.length > 0 ? `    - ${parts.join(" | ")}` : "    - (empty)";
        })
        .join("\n");
      return {
        content: [
          {
            type: "text" as const,
            text: [
              `${f.name} [${f.status}]`,
              `  ID: ${f.id}`,
              f.order ? `  Order: ${f.order.name} (${f.order.id})` : "",
              f.totalQuantity !== null && f.totalQuantity !== undefined
                ? `  Total quantity: ${f.totalQuantity}`
                : "",
              "  Tracking:",
              tracking || "    (none)",
              `  Created: ${f.createdAt}`,
              `  Updated: ${f.updatedAt}`,
            ]
              .filter(Boolean)
              .join("\n"),
          },
        ],
      };
    },
  • Schema definition for get_fulfillment: requires a single 'id' string parameter (Fulfillment GID).
    const getFulfillmentSchema = {
      id: z.string().describe("Fulfillment GID."),
    };
  • GET_FULFILLMENT_QUERY GraphQL query used by the handler to fetch fulfillment details.
    const GET_FULFILLMENT_QUERY = /* GraphQL */ `
      query GetFulfillment($id: ID!) {
        fulfillment(id: $id) {
          id
          status
          name
          createdAt
          updatedAt
          totalQuantity
          trackingInfo { company number url }
          order { id name }
        }
      }
    `;
  • Import of registerFulfillmentTools in the main server file.
    import { registerFulfillmentTools } from "./tools/fulfillment.js";
Behavior3/5

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

No annotations are provided, so the description carries the burden. It discloses that the tool returns status, tracking entries, parent order, and timestamps, and implies a read-only operation. However, it does not mention potential errors, permissions, or side effects.

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 two sentences: the first front-loads the core purpose and separates details in the second. Every sentence adds value with no wasted words.

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 a single simple parameter and no output schema, the description adequately explains what is returned and provides usage context, making the tool complete for an agent to understand.

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 has 100% coverage for the single parameter 'id' with a description 'Fulfillment GID.' The description adds context by stating it is a GID, but does not add significant new meaning beyond the schema.

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 verb 'Fetch' and the resource 'a single fulfillment', and distinguishes it from sibling tools like create_fulfillment and cancel_fulfillment by specifying it is for retrieving an existing 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?

The description explicitly provides two specific use cases: after create_fulfillment to confirm shipment, and when a webhook provides a fulfillment GID. It implies when to use this tool but does not include explicit exclusions or 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