Skip to main content
Glama

Superprecio MCP Server

by bunkerapps
optimizeShoppingList.tsβ€’3.71 kB
/** * MCP Tool: Optimize Shopping List * πŸ”₯ THE STAR FEATURE - Find the best supermarket for your entire shopping list */ import type { SuperPrecioApiClient } from '../client/superPrecioApi.js'; export const optimizeShoppingListTool = { name: 'optimize_shopping_list', description: `πŸ”₯ OPTIMIZE YOUR SHOPPING - Find the best supermarket for your entire shopping list! This is the most powerful feature. It: 1. Searches for every product in your list across ALL supermarkets 2. Calculates the total cost at each supermarket 3. Shows you exactly how much you'll save by choosing the cheapest option 4. Provides a complete breakdown with prices per item Perfect for: - Maximizing your savings - Planning where to shop - Comparing complete shopping costs - Making informed decisions The tool searches ALL active supermarkets in Argentina and tells you which one gives you the best total price for your entire basket.`, inputSchema: { type: 'object', properties: { listId: { type: 'number', description: 'ID of the shopping list to optimize', }, }, required: ['listId'], }, }; export async function executeOptimizeShoppingList( client: SuperPrecioApiClient, args: { listId: number } ) { const response = await client.optimizeShoppingList(args.listId); if (!response.success) { return { content: [ { type: 'text', text: `Failed to optimize shopping list: ${response.message || 'Unknown error'}`, }, ], isError: true, }; } const { bestMarket, savings, allMarkets, listName, totalItems, marketsCompared } = response; const summary = ` πŸ† OPTIMIZATION RESULTS FOR "${listName}" ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ πŸ’° BEST SUPERMARKET: ${bestMarket.name} Total: $${bestMarket.total.toLocaleString('es-AR')} Found: ${bestMarket.foundItems}/${totalItems} products ${bestMarket.missingItems > 0 ? `⚠️ Missing: ${bestMarket.missingItems} items` : 'βœ… All items found!'} ${savings.amount > 0 ? ` πŸ’Έ YOUR SAVINGS: $${savings.amount.toLocaleString('es-AR')} (${savings.percentage}%) vs. shopping at ${savings.comparedTo} ` : ''} πŸ“Š PRICE COMPARISON (${marketsCompared} supermarkets) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ${allMarkets .map((market: any, i: number) => { const badge = i === 0 ? 'πŸ† BEST ' : i === allMarkets.length - 1 ? '❌ WORST' : ' '; return `${badge} ${i + 1}. ${market.name.padEnd(20)} $${market.total.toLocaleString('es-AR').padStart(10)} (${market.foundItems}/${totalItems} found)`; }) .join('\n')} πŸ›’ ITEMS AT ${bestMarket.name}: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ${bestMarket.items .map((item: any, i: number) => { return `${i + 1}. ${item.productName} Qty: ${item.quantity} x $${item.unitPrice.toLocaleString('es-AR')} = $${item.totalPrice.toLocaleString('es-AR')}`; }) .join('\n\n')} ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🎯 RECOMMENDATION: Shop at ${bestMarket.name} πŸ’΅ TOTAL TO PAY: $${bestMarket.total.toLocaleString('es-AR')} ${savings.amount > 0 ? `πŸ’° YOU SAVE: $${savings.amount.toLocaleString('es-AR')}` : ''} `; return { content: [ { type: 'text', text: summary, }, { type: 'text', text: JSON.stringify(response, null, 2), }, ], }; }

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/bunkerapps/superprecio_mcp'

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