Skip to main content
Glama

list_draft_orders

Retrieve draft orders (uncompleted carts/quotes) sorted by most recently updated. Filter by status, customer, tag, or update time to find specific drafts.

Instructions

List draft orders (carts/quotes that haven't yet been completed into real orders), most recently updated first. Returns each draft's name (e.g. 'D1023'), status (OPEN/COMPLETED/INVOICE_SENT), total price, customer name, and whether it's already been converted to an order. Supports Shopify's draft-order query syntax for filtering by status, customer, tag, or update time. Cursor-paginated.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
firstNoPage size (1-100).
queryNoShopify draft order query syntax. Examples: 'status:OPEN' (not yet completed), 'status:COMPLETED', 'customer_id:1234567890', 'tag:wholesale', 'updated_at:>=2026-01-01'.
afterNoCursor from the previous page's pageInfo. Omit on the first call.

Implementation Reference

  • The registerDraftOrderTools function registers all draft order tools including 'list_draft_orders' on the McpServer via server.tool() at line 296.
    export function registerDraftOrderTools(
      server: McpServer,
      client: ShopifyClient,
    ): void {
      server.tool(
        "list_draft_orders",
        "List draft orders (carts/quotes that haven't yet been completed into real orders), most recently updated first. Returns each draft's name (e.g. 'D1023'), status (OPEN/COMPLETED/INVOICE_SENT), total price, customer name, and whether it's already been converted to an order. Supports Shopify's draft-order query syntax for filtering by status, customer, tag, or update time. Cursor-paginated.",
        listDraftOrdersSchema,
        async (args) => {
          const data = await client.graphql<{
            draftOrders: Connection<DraftOrder>;
          }>(LIST_DRAFT_ORDERS_QUERY, {
            first: args.first,
            after: args.after,
            query: args.query,
          });
          const lines = [
            `Found ${data.draftOrders.edges.length} draft order(s):`,
            ...data.draftOrders.edges.map(({ node }) => {
              const total = `${node.totalPriceSet.shopMoney.amount} ${node.totalPriceSet.shopMoney.currencyCode}`;
              const customer = node.customer?.displayName ?? "(no customer)";
              const completed = node.order
                ? ` → order ${node.order.name}`
                : "";
              return `  ${node.name} [${node.status}] ${total} — ${customer}${completed} — ${node.id}`;
            }),
          ];
          return { content: [{ type: "text" as const, text: lines.join("\n") }] };
        },
      );
  • The async handler for list_draft_orders executes the GraphQL query, formats the results into a text summary listing each draft order's name, status, total price, customer, and whether it was converted to an order.
      async (args) => {
        const data = await client.graphql<{
          draftOrders: Connection<DraftOrder>;
        }>(LIST_DRAFT_ORDERS_QUERY, {
          first: args.first,
          after: args.after,
          query: args.query,
        });
        const lines = [
          `Found ${data.draftOrders.edges.length} draft order(s):`,
          ...data.draftOrders.edges.map(({ node }) => {
            const total = `${node.totalPriceSet.shopMoney.amount} ${node.totalPriceSet.shopMoney.currencyCode}`;
            const customer = node.customer?.displayName ?? "(no customer)";
            const completed = node.order
              ? ` → order ${node.order.name}`
              : "";
            return `  ${node.name} [${node.status}] ${total} — ${customer}${completed} — ${node.id}`;
          }),
        ];
        return { content: [{ type: "text" as const, text: lines.join("\n") }] };
      },
    );
  • Input schema for list_draft_orders: first (page size, 1-100, default 20), query (Shopify draft order query syntax string), after (cursor for pagination).
    const listDraftOrdersSchema = {
      first: z
        .number()
        .int()
        .min(1)
        .max(100)
        .default(20)
        .describe("Page size (1-100)."),
      query: z
        .string()
        .optional()
        .describe(
          "Shopify draft order query syntax. Examples: 'status:OPEN' (not yet completed), 'status:COMPLETED', 'customer_id:1234567890', 'tag:wholesale', 'updated_at:>=2026-01-01'.",
        ),
      after: z
        .string()
        .optional()
        .describe("Cursor from the previous page's pageInfo. Omit on the first call."),
    };
  • The GraphQL query used by list_draft_orders to fetch draft orders sorted by UPDATED_AT descending, with pagination via first/after/query parameters.
    const LIST_DRAFT_ORDERS_QUERY = /* GraphQL */ `
      query ListDraftOrders($first: Int!, $after: String, $query: String) {
        draftOrders(first: $first, after: $after, query: $query, sortKey: UPDATED_AT, reverse: true) {
          edges {
            cursor
            node {
              id
              name
              status
              totalPriceSet { shopMoney { amount currencyCode } }
              customer { id displayName email }
              createdAt
              updatedAt
              completedAt
              order { id name }
            }
          }
          pageInfo { hasNextPage hasPreviousPage startCursor endCursor }
        }
      }
    `;
  • Registration call: registerDraftOrderTools(s, shopify) is invoked inside buildContext() to wire the draft order tools into the MCP server.
    const s = new McpServer({ name: "shopify-mcp", version: "0.1.0" });
    registerProductTools(s, shopify);
    registerOrderTools(s, shopify);
    registerInventoryTools(s, shopify);
    registerCustomerTools(s, shopify);
    registerMetafieldTools(s, shopify);
    registerDraftOrderTools(s, shopify);
Behavior4/5

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

No annotations provided, so description carries full burden. It discloses cursor-based pagination, filtering, and returned data. Does not mention auth or rate limits, but adequately covers key behaviors.

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?

Single paragraph well-organized: purpose, return fields, filtering, pagination. No redundant sentences, 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?

No output schema, but description enumerates returned fields. Covers pagination, sorting, filtering, and query syntax. Complete for a list tool operation.

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?

Schema descriptions cover 100% of parameters. Description adds value through examples for the 'query' parameter, going beyond the schema. Still room for more detail on cursor usage.

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 lists draft orders with definition, ordering, and returned fields. Distinguishes from siblings like get_draft_order and complete_draft_order through context.

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?

Implies usage for listing all draft orders, mentions filtering syntax, but lacks explicit when-to-use vs alternatives like get_draft_order. However, context signals are clear enough.

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