Skip to main content
Glama

Superprecio MCP Server

by bunkerapps
searchProducts.ts2.82 kB
/** * MCP Tool: Search Products * Searches for products by description across all supermarkets */ import type { SuperPrecioApiClient } from '../client/superPrecioApi.js'; export const searchProductsTool = { name: 'search_products', description: `Search for products by name or description across all Argentina supermarkets. This tool searches multiple supermarkets simultaneously and returns price comparisons. It's perfect for finding the best deals and comparing prices across different stores. The search is smart and handles: - Spanish characters and accents (café, leche, etc.) - Partial matches - Common product names - Brand names Results include: - Product images - Prices - Direct links to products - Supermarket information - Availability across stores`, inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Product name or description to search for (e.g., "leche descremada", "arroz integral", "coca cola")', }, maxResults: { type: 'number', description: 'Maximum number of results per supermarket (1-50, default: 9)', minimum: 1, maximum: 50, default: 9, }, sortBy: { type: 'string', description: 'How to sort the results', enum: ['OrderByTopSaleDESC', 'OrderByPriceASC', 'OrderByPriceDESC'], default: 'OrderByTopSaleDESC', }, }, required: ['query'], }, }; export async function executeSearchProducts( client: SuperPrecioApiClient, args: { query: string; maxResults?: number; sortBy?: 'OrderByTopSaleDESC' | 'OrderByPriceASC' | 'OrderByPriceDESC'; } ) { const { query, maxResults = 9, sortBy = 'OrderByTopSaleDESC' } = args; const response = await client.searchProducts({ search: query, maxResults, order: sortBy, }); // Format response for better readability const results = { summary: { query: response.searched.search, totalSupermarkets: response.columns, totalProducts: response.allData.reduce((sum, market) => sum + market.length, 0), }, supermarkets: response.markets.map((market) => ({ name: market.name, logo: market.logo, })), products: response.allData.map((marketProducts, idx) => ({ supermarket: response.markets[idx] ? response.markets[idx].name : 'Unknown', logo: response.markets[idx] ? response.markets[idx].logo : '', products: marketProducts.map((product) => ({ name: product.desc, price: product.price, image: product.img, link: product.link, code: product.code, barcode: product.barcode, })), })), }; return { content: [ { type: 'text', text: JSON.stringify(results, null, 2), }, ], }; }

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