Skip to main content
Glama

Superprecio MCP Server

by bunkerapps
getShoppingLists.tsβ€’2.33 kB
/** * MCP Tool: Get Shopping Lists * Retrieve all shopping lists or filter by user */ import type { SuperPrecioApiClient } from '../client/superPrecioApi.js'; export const getShoppingListsTool = { name: 'get_shopping_lists', description: `Get all shopping lists, optionally filtered by user. Returns a list of all active shopping lists with their items. Useful for: - Viewing all your saved lists - Finding a specific list to optimize - Managing multiple shopping lists`, inputSchema: { type: 'object', properties: { userId: { type: 'number', description: 'Optional: Filter lists by user ID', }, }, }, }; export async function executeGetShoppingLists( client: SuperPrecioApiClient, args: { userId?: number } ) { const response = await client.getShoppingLists(args); if (!response.success) { return { content: [ { type: 'text', text: `Failed to get shopping lists: ${response.message || 'Unknown error'}`, }, ], isError: true, }; } const lists = response.data; const count = response.count || 0; if (count === 0) { return { content: [ { type: 'text', text: ` No shopping lists found. Create your first list with create_shopping_list! `, }, ], }; } const summary = ` πŸ“‹ Your Shopping Lists (${count} total) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ${lists .map((list: any, i: number) => { const itemCount = list.items?.length || 0; return ` ${i + 1}. ${list.name} (ID: ${list.id}) ${list.description ? `πŸ“„ ${list.description}` : ''} πŸ›’ Items: ${itemCount} πŸ“… Created: ${new Date(list.createdAt).toLocaleDateString('es-AR')} ${itemCount > 0 ? ` Products: ${list.items.slice(0, 3).map((item: any) => item.productName).join(', ')}${itemCount > 3 ? '...' : ''}` : ''} `; }) .join('\n')} Actions you can take: - optimize_shopping_list - Find best supermarket for a list - add_items_to_list - Add more products - remove_shopping_list - Delete a 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