Skip to main content
Glama
bunkerapps

Superprecio MCP Server

by bunkerapps

search_by_code

Find exact product matches by scanning EAN/barcodes to compare prices and check availability across multiple supermarkets in Argentina.

Instructions

Search for a specific product by its EAN/barcode across all supermarkets.

This tool is perfect for:

  • Finding exact product matches

  • Scanning barcodes

  • Price checking specific items

  • Verifying product availability

The barcode/EAN search will find the exact same product across different stores, making it ideal for precise price comparisons.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesProduct EAN/barcode (numeric code, usually 13 digits)

Implementation Reference

  • The handler function that implements the core logic of the 'search_by_code' tool. It calls the SuperPrecio API, processes the response, and formats it for MCP output.
    export async function executeSearchByCode( client: SuperPrecioApiClient, args: { code: string } ) { if (!args) { throw new Error('Missing required arguments'); } const { code } = args; const response = await client.searchByCode(code); // Format response const results = { summary: { barcode: code, totalSupermarkets: response.columns, foundIn: response.allData.length, }, availability: response.allData.map((marketProducts, idx) => { const market = response.markets[idx]; if (!marketProducts || marketProducts.length === 0) { return { supermarket: market ? market.name : 'Unknown', available: false, }; } const product = marketProducts[0]; return { supermarket: market ? market.name : 'Unknown', logo: market ? market.logo : '', available: true, product: { name: product.desc, price: product.price, image: product.img, link: product.link, code: product.code, }, }; }), }; return { content: [ { type: 'text', text: JSON.stringify(results, null, 2), }, ], }; }
  • The schema definition for the 'search_by_code' tool, including name, description, and input validation schema.
    export const searchByCodeTool = { name: 'search_by_code', description: `Search for a specific product by its EAN/barcode across all supermarkets. This tool is perfect for: - Finding exact product matches - Scanning barcodes - Price checking specific items - Verifying product availability The barcode/EAN search will find the exact same product across different stores, making it ideal for precise price comparisons.`, inputSchema: { type: 'object', properties: { code: { type: 'string', description: 'Product EAN/barcode (numeric code, usually 13 digits)', }, }, required: ['code'], }, };
  • src/index.ts:128-129 (registration)
    Registration of the tool handler in the MCP server's CallToolRequestSchema switch statement, dispatching to executeSearchByCode.
    case 'search_by_code': return await executeSearchByCode(apiClient, args as any);
  • src/index.ts:90-116 (registration)
    Registration of the tool in the MCP server's ListToolsRequestSchema response, including searchByCodeTool in the list of available tools.
    return { tools: [ // V1 Tools searchProductsTool, searchByCodeTool, comparePriceTool, getBestDealsTool, sendNotificationTool, subscribeDeviceTool, // V2 Tools - Shopping Lists createShoppingListTool, addItemsToListTool, getShoppingListsTool, optimizeShoppingListTool, removeShoppingListTool, // V2 Tools - Price Alerts setPriceAlertTool, getMyAlertsTool, removePriceAlertTool, // V2 Tools - Location findNearbySupermarketsTool, ], }; });
  • Helper method in the API client that performs the actual HTTP request to search products by code.
    async searchByCode(code: string): Promise<SearchResponse> { try { const response = await this.client.post<SearchResponse>('/api/productsByCode', { search: code, }); return response.data; } catch (error) { throw this.handleError(error); } }

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