list_orders
Retrieve all orders from a Mailchimp store to track purchases and analyze sales data. Provide the store ID to access order information.
Instructions
List all orders in a store
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| store_id | Yes | The store ID |
Implementation Reference
- src/tools/index.ts:1103-1121 (handler)The specific handler case for the 'list_orders' tool in the handleToolCall function. It calls service.listOrders with the store_id argument, maps the orders to a summary, and returns formatted MCP content.case "list_orders": const orders = await service.listOrders(args.store_id); return { content: [ { type: "text", text: JSON.stringify( orders.orders.map((o) => ({ id: o.id, order_total: o.order_total, currency_code: o.currency_code, financial_status: o.financial_status, })), null, 2 ), }, ], };
- src/tools/index.ts:484-497 (schema)The tool schema definition in getToolDefinitions array, specifying name, description, and input schema that requires a 'store_id' string parameter.{ name: "list_orders", description: "List all orders in a store", inputSchema: { type: "object", properties: { store_id: { type: "string", description: "The store ID", }, }, required: ["store_id"], }, },
- src/services/mailchimp.ts:329-335 (helper)Helper method in MailchimpService that performs the actual API call to list orders for a store using a paginated request to the Mailchimp E-commerce endpoint.async listOrders(storeId: string): Promise<{ orders: MailchimpOrder[] }> { return await this.makePaginatedRequest( `/ecommerce/stores/${storeId}/orders`, "processed_at_foreign", "DESC" ); }
- src/types/index.ts:833-908 (schema)TypeScript interface MailchimpOrder defining the structure of order objects returned by the listOrders service method, serving as output schema.export interface MailchimpOrder { id: string; customer: { id: string; email_address: string; opt_in_status: boolean; company?: string; first_name?: string; last_name?: string; orders_count: number; total_spent: number; address?: { address1: string; address2: string; city: string; province: string; province_code: string; postal_code: string; country: string; country_code: string; }; }; store_id: string; campaign_id?: string; landing_site?: string; financial_status: string; fulfillment_status: string; currency_code: string; order_total: number; order_url?: string; discount_total: number; tax_total: number; shipping_total: number; tracking_code?: string; processed_at_foreign?: string; cancelled_at_foreign?: string; updated_at_foreign?: string; shipping_address?: { name: string; address1: string; address2: string; city: string; province: string; province_code: string; postal_code: string; country: string; country_code: string; }; billing_address?: { name: string; address1: string; address2: string; city: string; province: string; province_code: string; postal_code: string; country: string; country_code: string; }; lines: Array<{ id: string; product_id: string; product_title: string; product_variant_id: string; product_variant_title: string; quantity: number; price: number; }>; _links?: Array<{ rel: string; href: string; method: string; targetSchema?: string; schema?: string; }>; }
- src/index.ts:42-46 (registration)MCP server registration of tools list via ListToolsRequestSchema handler, which provides the tool definitions including 'list_orders'.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: getToolDefinitions(mailchimpService), }; });