create-order
Process customer orders by specifying variants, address, and payment details directly within Terminal.shop MCP Server.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| addressID | Yes | ||
| cardID | Yes | ||
| variants | Yes |
Implementation Reference
- server.js:783-813 (handler)The handler function for the 'create-order' tool. It sends a POST request to the Terminal.shop /order endpoint with the provided variants (product variant IDs mapped to quantities), addressID, and cardID. Returns success message with order ID or error.async ({ variants, addressID, cardID }) => { try { const response = await terminalApi.post("/order", { variants, addressID, cardID, }); const orderID = response.data.data; return { content: [ { type: "text", text: `Order created successfully! Order ID: ${orderID}`, }, ], }; } catch (error) { console.error("Error creating order:", error); return { content: [ { type: "text", text: `Error creating order: ${error.message}`, }, ], isError: true, }; } },
- server.js:778-782 (schema)Input schema using Zod: variants as a record of variant ID strings to quantity numbers, addressID string, cardID string.{ variants: z.record(z.string(), z.number()), addressID: z.string(), cardID: z.string(), },
- server.js:776-814 (registration)Registration of the 'create-order' tool using server.tool(), including name, input schema, and inline handler function.server.tool( "create-order", { variants: z.record(z.string(), z.number()), addressID: z.string(), cardID: z.string(), }, async ({ variants, addressID, cardID }) => { try { const response = await terminalApi.post("/order", { variants, addressID, cardID, }); const orderID = response.data.data; return { content: [ { type: "text", text: `Order created successfully! Order ID: ${orderID}`, }, ], }; } catch (error) { console.error("Error creating order:", error); return { content: [ { type: "text", text: `Error creating order: ${error.message}`, }, ], isError: true, }; } }, );