Skip to main content
Glama
pashaydev

Terminal.shop MCP Server

by pashaydev

checkout

Complete purchases and place orders for items in your Terminal.shop shopping cart using the Terminal.shop MCP Server.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'checkout' tool. It calls the Terminal.shop API to convert the current cart into an order (/cart/convert), formats the order details including shipping, tracking, items, and totals, and returns a text response. Includes error handling with console.error and error message response.
    server.tool("checkout", {}, async () => { try { const response = await terminalApi.post("/cart/convert"); const order = response.data.data; let formattedText = "# Order Placed Successfully!\n\n"; formattedText += `Order ID: ${order.id}\n`; // Shipping information formattedText += "\n## Shipping Information\n"; formattedText += `Name: ${order.shipping.name}\n`; formattedText += `Address: ${order.shipping.street1}${order.shipping.street2 ? `, ${order.shipping.street2}` : ""}\n`; formattedText += `${order.shipping.city}, ${order.shipping.province || ""} ${order.shipping.zip}\n`; formattedText += `Country: ${order.shipping.country}\n`; if (order.shipping.phone) formattedText += `Phone: ${order.shipping.phone}\n`; // Tracking information if available if (order.tracking) { formattedText += "\n## Tracking Information\n"; formattedText += `Service: ${order.tracking.service}\n`; formattedText += `Tracking Number: ${order.tracking.number}\n`; formattedText += `Tracking URL: ${order.tracking.url}\n`; } // Order details formattedText += "\n## Order Details\n"; order.items.forEach((item) => { formattedText += `- Quantity: ${item.quantity}, Amount: $${item.amount / 100}, Variant ID: ${item.productVariantID}\n`; }); // Totals formattedText += "\n## Order Totals\n"; formattedText += `Subtotal: $${order.amount.subtotal / 100}\n`; formattedText += `Shipping: $${order.amount.shipping / 100}\n`; formattedText += `Total: $${(order.amount.subtotal + order.amount.shipping) / 100}\n`; return { content: [ { type: "text", text: formattedText, }, ], }; } catch (error) { console.error("Error during checkout:", error); return { content: [ { type: "text", text: `Error during checkout: ${error.message}`, }, ], isError: true, }; } });
  • server.js:716-773 (registration)
    The registration of the 'checkout' tool using server.tool with empty input schema ({}). The handler is inline.
    server.tool("checkout", {}, async () => { try { const response = await terminalApi.post("/cart/convert"); const order = response.data.data; let formattedText = "# Order Placed Successfully!\n\n"; formattedText += `Order ID: ${order.id}\n`; // Shipping information formattedText += "\n## Shipping Information\n"; formattedText += `Name: ${order.shipping.name}\n`; formattedText += `Address: ${order.shipping.street1}${order.shipping.street2 ? `, ${order.shipping.street2}` : ""}\n`; formattedText += `${order.shipping.city}, ${order.shipping.province || ""} ${order.shipping.zip}\n`; formattedText += `Country: ${order.shipping.country}\n`; if (order.shipping.phone) formattedText += `Phone: ${order.shipping.phone}\n`; // Tracking information if available if (order.tracking) { formattedText += "\n## Tracking Information\n"; formattedText += `Service: ${order.tracking.service}\n`; formattedText += `Tracking Number: ${order.tracking.number}\n`; formattedText += `Tracking URL: ${order.tracking.url}\n`; } // Order details formattedText += "\n## Order Details\n"; order.items.forEach((item) => { formattedText += `- Quantity: ${item.quantity}, Amount: $${item.amount / 100}, Variant ID: ${item.productVariantID}\n`; }); // Totals formattedText += "\n## Order Totals\n"; formattedText += `Subtotal: $${order.amount.subtotal / 100}\n`; formattedText += `Shipping: $${order.amount.shipping / 100}\n`; formattedText += `Total: $${(order.amount.subtotal + order.amount.shipping) / 100}\n`; return { content: [ { type: "text", text: formattedText, }, ], }; } catch (error) { console.error("Error during checkout:", error); return { content: [ { type: "text", text: `Error during checkout: ${error.message}`, }, ], isError: true, }; } });
  • Empty input schema for the 'checkout' tool (no parameters required).
    server.tool("checkout", {}, async () => {

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