get-app-data
Retrieve application data from Terminal.shop to access product listings, shopping cart details, order information, and subscription management through API integration.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.js:1165-1227 (handler)Inline handler for 'get-app-data' tool: Fetches comprehensive app data via terminalApi.get('/view/init'), formats it into a markdown overview of profile, cart, orders, subscriptions, and products, returns as text content block. Includes error handling.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 (registration)Registration of the 'get-app-data' tool using server.tool with empty schema {} and inline async handler.server.tool("get-app-data", {}, async () => {