Skip to main content
Glama

list_orders

Retrieve shop orders ordered by creation date, newest first. Filter by financial status, fulfillment status, date range, tags, and more. Returns key details and pagination cursors for subsequent calls.

Instructions

List orders in the store, newest first by creation date. Returns each order's name (e.g. '#1042'), total price (in shop currency), financial status (paid/pending/refunded), fulfillment status (fulfilled/unfulfilled/partial), and timestamp. Supports Shopify's order query syntax for filtering by status, date range, customer, tags, and more. Cursor-paginated; the last line shows the next cursor when more pages exist. Use this to find order GIDs before calling get_order or list_fulfillment_orders.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
firstNoPage size (1-100).
queryNoShopify order query syntax. Common filters: 'financial_status:paid' (paid/pending/refunded/voided), 'fulfillment_status:unfulfilled' (unfulfilled/fulfilled/partial), 'status:open' (open/closed/cancelled), 'created_at:>=2026-01-01', 'tag:wholesale', 'name:#1001'. Combine with AND/OR/NOT.
afterNoCursor from a prior page's pageInfo for pagination. Omit on the first call.

Implementation Reference

  • Handler function for the 'list_orders' tool. Executes a GraphQL query against the Shopify Admin API to list orders with pagination and filtering, then formats the results as text.
    server.tool(
      "list_orders",
      "List orders in the store, newest first by creation date. Returns each order's name (e.g. '#1042'), total price (in shop currency), financial status (paid/pending/refunded), fulfillment status (fulfilled/unfulfilled/partial), and timestamp. Supports Shopify's order query syntax for filtering by status, date range, customer, tags, and more. Cursor-paginated; the last line shows the next cursor when more pages exist. Use this to find order GIDs before calling get_order or list_fulfillment_orders.",
      listOrdersSchema,
      async (args) => {
        const data = await client.graphql<{ orders: Connection<Order> }>(
          LIST_ORDERS_QUERY,
          { first: args.first, query: args.query, after: args.after },
        );
        const lines = [
          `Found ${data.orders.edges.length} order(s):`,
          ...data.orders.edges.map(({ node }) => {
            const amount = node.totalPriceSet.shopMoney;
            return `  ${node.name} — ${amount.amount} ${amount.currencyCode} — ${node.displayFinancialStatus ?? "?"}/${node.displayFulfillmentStatus ?? "?"} — ${node.createdAt}`;
          }),
          data.orders.pageInfo.hasNextPage
            ? `next cursor: ${data.orders.edges[data.orders.edges.length - 1]?.cursor}`
            : "(end of results)",
        ];
        return { content: [{ type: "text" as const, text: lines.join("\n") }] };
      },
    );
  • Input schema for list_orders: 'first' (page size, 1-100, default 20), optional 'query' (Shopify filter syntax), optional 'after' (pagination cursor).
    const listOrdersSchema = {
      first: z
        .number()
        .int()
        .min(1)
        .max(100)
        .default(20)
        .describe("Page size (1-100)."),
      query: z
        .string()
        .optional()
        .describe(
          "Shopify order query syntax. Common filters: 'financial_status:paid' (paid/pending/refunded/voided), 'fulfillment_status:unfulfilled' (unfulfilled/fulfilled/partial), 'status:open' (open/closed/cancelled), 'created_at:>=2026-01-01', 'tag:wholesale', 'name:#1001'. Combine with AND/OR/NOT.",
        ),
      after: z
        .string()
        .optional()
        .describe(
          "Cursor from a prior page's pageInfo for pagination. Omit on the first call.",
        ),
    };
  • Registration of 'list_orders' on the MCP server via server.tool() in the registerOrderTools function.
    server.tool(
      "list_orders",
      "List orders in the store, newest first by creation date. Returns each order's name (e.g. '#1042'), total price (in shop currency), financial status (paid/pending/refunded), fulfillment status (fulfilled/unfulfilled/partial), and timestamp. Supports Shopify's order query syntax for filtering by status, date range, customer, tags, and more. Cursor-paginated; the last line shows the next cursor when more pages exist. Use this to find order GIDs before calling get_order or list_fulfillment_orders.",
      listOrdersSchema,
      async (args) => {
        const data = await client.graphql<{ orders: Connection<Order> }>(
          LIST_ORDERS_QUERY,
          { first: args.first, query: args.query, after: args.after },
        );
        const lines = [
          `Found ${data.orders.edges.length} order(s):`,
          ...data.orders.edges.map(({ node }) => {
            const amount = node.totalPriceSet.shopMoney;
            return `  ${node.name} — ${amount.amount} ${amount.currencyCode} — ${node.displayFinancialStatus ?? "?"}/${node.displayFulfillmentStatus ?? "?"} — ${node.createdAt}`;
          }),
          data.orders.pageInfo.hasNextPage
            ? `next cursor: ${data.orders.edges[data.orders.edges.length - 1]?.cursor}`
            : "(end of results)",
        ];
        return { content: [{ type: "text" as const, text: lines.join("\n") }] };
      },
    );
  • src/server.ts:58-58 (registration)
    Top-level registration call from server.ts that invokes registerOrderTools, which registers list_orders and other order tools.
    registerOrderTools(s, shopify);
  • GraphQL query used by list_orders to fetch orders, sorted by creation date descending.
    const LIST_ORDERS_QUERY = /* GraphQL */ `
      query ListOrders($first: Int!, $after: String, $query: String) {
        orders(first: $first, after: $after, query: $query, sortKey: CREATED_AT, reverse: true) {
          edges {
            cursor
            node {
              id
              name
              email
              displayFinancialStatus
              displayFulfillmentStatus
              totalPriceSet { shopMoney { amount currencyCode } }
              createdAt
            }
          }
          pageInfo { hasNextPage hasPreviousPage startCursor endCursor }
        }
      }
    `;
Behavior4/5

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

No annotations are provided, so the description must carry the full burden. It discloses pagination behavior (cursor-based, next cursor shown), ordering (newest first), and query syntax. It does not mention error handling or rate limits, but for a read-only list tool this is adequate.

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 three sentences, front-loading the main purpose and returned fields, then adding pagination and usage guidance. 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?

Despite no output schema, the description enumerates the returned fields (name, total price, financial status, fulfillment status, timestamp) and covers pagination, ordering, and filtering. This is complete for a list tool given the context.

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 100% description coverage for all 3 parameters. The description adds value by explaining the cursor-paginated behavior (relevant to 'after'), providing examples of common query filters (relevant to 'query'), and setting default page size context. This goes beyond the schema descriptions.

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?

Description clearly states it lists orders with specific returned fields (name, total price, financial status, fulfillment status, timestamp) and mentions ordering by creation date. It distinguishes itself from siblings like get_order and list_fulfillment_orders by noting it is used to find order GIDs before those calls.

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?

Description explicitly states when to use this tool: to find order GIDs before calling get_order or list_fulfillment_orders. It also describes supported query syntax for filtering. While it doesn't explicitly list when not to use, the context is clear and provides sufficient guidance for an AI agent.

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