get-app-data
Retrieve essential app data from Terminal.shop MCP Server to manage products, shopping carts, orders, and subscriptions via API integration for streamlined operations.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.js:1165-1227 (handler)The handler function for the 'get-app-data' tool, registered inline with server.tool(). It fetches comprehensive app data from the Terminal.shop API endpoint '/view/init' and formats a textual overview of the user's profile, cart, recent orders, subscriptions, and available products.server.tool("get-app-data", {}, async () => { try { const response = await terminalApi.get("/view/init"); const data = response.data.data; let formattedText = "# Terminal.shop Account Overview\n\n"; // Profile formattedText += "## Your Profile\n"; formattedText += `Name: ${data.profile.user.name || "Not set"}\n`; formattedText += `Email: ${data.profile.user.email || "Not set"}\n`; formattedText += `Region: ${data.region}\n\n`; // Cart formattedText += "## Your Cart\n"; if (data.cart.items.length === 0) { formattedText += "Your cart is empty.\n\n"; } else { formattedText += `Items in cart: ${data.cart.items.length}\n`; formattedText += `Cart subtotal: $${data.cart.subtotal / 100}\n\n`; } // Orders formattedText += "## Recent Orders\n"; if (data.orders.length === 0) { formattedText += "You haven't placed any orders yet.\n\n"; } else { formattedText += `You have ${data.orders.length} order(s).\n\n`; } // Subscriptions formattedText += "## Subscriptions\n"; if (data.subscriptions.length === 0) { formattedText += "You don't have any active subscriptions.\n\n"; } else { formattedText += `You have ${data.subscriptions.length} active subscription(s).\n\n`; } // Products formattedText += "## Available Products\n"; formattedText += `${data.products.length} products available in the shop.\n\n`; return { content: [ { type: "text", text: formattedText, }, ], }; } catch (error) { console.error("Error getting app data:", error); return { content: [ { type: "text", text: `Error getting app data: ${error.message}`, }, ], isError: true, }; } });
- server.js:1165-1227 (registration)Registration of the 'get-app-data' tool using server.tool(), with no input parameters (empty schema) and an inline async handler function.server.tool("get-app-data", {}, async () => { try { const response = await terminalApi.get("/view/init"); const data = response.data.data; let formattedText = "# Terminal.shop Account Overview\n\n"; // Profile formattedText += "## Your Profile\n"; formattedText += `Name: ${data.profile.user.name || "Not set"}\n`; formattedText += `Email: ${data.profile.user.email || "Not set"}\n`; formattedText += `Region: ${data.region}\n\n`; // Cart formattedText += "## Your Cart\n"; if (data.cart.items.length === 0) { formattedText += "Your cart is empty.\n\n"; } else { formattedText += `Items in cart: ${data.cart.items.length}\n`; formattedText += `Cart subtotal: $${data.cart.subtotal / 100}\n\n`; } // Orders formattedText += "## Recent Orders\n"; if (data.orders.length === 0) { formattedText += "You haven't placed any orders yet.\n\n"; } else { formattedText += `You have ${data.orders.length} order(s).\n\n`; } // Subscriptions formattedText += "## Subscriptions\n"; if (data.subscriptions.length === 0) { formattedText += "You don't have any active subscriptions.\n\n"; } else { formattedText += `You have ${data.subscriptions.length} active subscription(s).\n\n`; } // Products formattedText += "## Available Products\n"; formattedText += `${data.products.length} products available in the shop.\n\n`; return { content: [ { type: "text", text: formattedText, }, ], }; } catch (error) { console.error("Error getting app data:", error); return { content: [ { type: "text", text: `Error getting app data: ${error.message}`, }, ], isError: true, }; } });
- server.js:1165-1165 (schema)Empty input schema for the 'get-app-data' tool ({}), indicating no required parameters.server.tool("get-app-data", {}, async () => {