Skip to main content
Glama
pashaydev

Terminal.shop MCP Server

by pashaydev

checkout

Process and finalize orders, manage shopping carts, and handle subscriptions through Terminal.shop's API, enabling streamlined e-commerce transactions for AI assistants.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler for the 'checkout' tool: Converts the shopping cart to an order by calling the /cart/convert API endpoint. Formats a detailed markdown response with order ID, shipping information, tracking details (if available), order items, and totals. Includes error handling with console logging and error 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)
    Registration of the 'checkout' tool using server.tool with empty schema and inline async handler.
    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 schema for the 'checkout' tool (no input 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