Skip to main content
Glama
pashaydev

Terminal.shop MCP Server

by pashaydev

create-order

Place orders on Terminal.shop by specifying product variants, shipping address, and payment card details to complete purchases.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
variantsYes
addressIDYes
cardIDYes

Implementation Reference

  • The handler function for the 'create-order' tool. It sends a POST request to the Terminal.shop /order endpoint with the provided variants, addressID, and cardID, then returns the created order ID or an error message.
    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,
        };
      }
    },
  • Zod schema defining the input parameters for the 'create-order' tool: variants (record of string to number), addressID (string), and 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' MCP tool on the McpServer instance, specifying the tool name, input schema, and 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,
          };
        }
      },
    );

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/pashaydev/terminal.shop.mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server