Skip to main content
Glama
bunkerapps

Superprecio MCP Server

by bunkerapps

search_by_code

Find exact product matches and compare prices across supermarkets by scanning EAN/barcodes. Use this tool to verify availability and check specific item pricing with precision.

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 executeSearchByCode function implements the core logic of the 'search_by_code' tool. It validates input, calls the SuperPrecio API client's searchByCode method, processes the response data from multiple supermarkets, and returns a formatted JSON result indicating availability and pricing.
    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),
          },
        ],
      };
    }
  • Defines the 'search_by_code' tool metadata, including name, detailed description, and input schema specifying the required 'code' parameter as a string.
    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)
    In the MCP server's CallToolRequestSchema handler, dispatches execution of 'search_by_code' to the executeSearchByCode function.
    case 'search_by_code':
      return await executeSearchByCode(apiClient, args as any);
  • src/index.ts:93-94 (registration)
    Registers the searchByCodeTool in the list of available tools returned by ListToolsRequestSchema handler.
    searchProductsTool,
    searchByCodeTool,
  • SuperPrecioApiClient method that sends HTTP POST request to '/api/productsByCode' endpoint with the code and returns the search response.
    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);
      }
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes the core behavior (exact product matching across supermarkets) and outcome (price comparisons). However, it lacks details about rate limits, error conditions, authentication requirements, or what happens when no matches are found. The description doesn't contradict any annotations since none exist.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a clear opening statement followed by bullet points for use cases and a concluding sentence about outcomes. It's appropriately sized for the tool's complexity. However, the bullet points could be more concise, and some redundancy exists between 'finding exact product matches' and 'exact same product across different stores.'

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter search tool with no annotations and no output schema, the description provides adequate context about what the tool does and when to use it. However, it doesn't describe the return format (what data comes back), error handling, or limitations. Given the lack of structured output documentation, more completeness would be beneficial.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, clearly documenting the single 'code' parameter as a numeric EAN/barcode. The description adds minimal value beyond the schema, only reinforcing that it searches by 'EAN/barcode' without providing additional format details or examples. This meets the baseline expectation when schema coverage is complete.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('search for a specific product') and resource ('by its EAN/barcode across all supermarkets'). It explicitly distinguishes this tool from sibling tools like 'search_products' by focusing on exact barcode-based matching rather than general product searches.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool ('perfect for finding exact product matches, scanning barcodes, price checking specific items, verifying product availability'). It distinguishes from 'search_products' by emphasizing exact matching across stores. However, it doesn't explicitly state when NOT to use it or mention specific alternatives like 'compare_prices' for broader comparisons.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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