Skip to main content
Glama

Superprecio MCP Server

by bunkerapps
addItemsToList.ts2.92 kB
/** * MCP Tool: Add Items to Shopping List * Add products to an existing shopping list */ import type { SuperPrecioApiClient } from '../client/superPrecioApi.js'; export const addItemsToListTool = { name: 'add_items_to_list', description: `Add products to an existing shopping list. You can add multiple items at once, each with: - Product name (required) - Barcode for exact matching (optional) - Quantity (default: 1) - Notes for specifications (optional) Perfect for building up your shopping list before optimizing.`, inputSchema: { type: 'object', properties: { listId: { type: 'number', description: 'ID of the shopping list to add items to', }, items: { type: 'array', description: 'Items to add to the list', items: { type: 'object', properties: { productName: { type: 'string', description: 'Product name (e.g., "Coca Cola 2.25L", "Pan lactal")', }, barcode: { type: 'string', description: 'Optional barcode/EAN for exact product matching', }, quantity: { type: 'number', description: 'Quantity needed (default: 1)', minimum: 1, default: 1, }, notes: { type: 'string', description: 'Optional notes (e.g., "sin sal", "integral")', }, }, required: ['productName'], }, minItems: 1, }, }, required: ['listId', 'items'], }, }; export async function executeAddItemsToList( client: SuperPrecioApiClient, args: { listId: number; items: Array<{ productName: string; barcode?: string; quantity?: number; notes?: string; }>; } ) { const response = await client.addItemsToList(args.listId, args.items); if (!response.success) { return { content: [ { type: 'text', text: `Failed to add items: ${response.message || 'Unknown error'}`, }, ], isError: true, }; } const list = response.data; const addedCount = response.addedItems || args.items.length; const summary = ` ✅ Items Added Successfully! 📝 List: ${list.name} ➕ Added: ${addedCount} ${addedCount === 1 ? 'item' : 'items'} 🛒 Total items in list: ${list.items?.length || 0} Newly added: ${args.items.map((item, i) => `${i + 1}. ${item.productName} (x${item.quantity || 1})${item.notes ? ` - ${item.notes}` : ''}`).join('\n')} Your list is ready! Next steps: - Add more items with add_items_to_list - Find the best supermarket with optimize_shopping_list `; return { content: [ { type: 'text', text: summary, }, { type: 'text', text: JSON.stringify(response.data, 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