Skip to main content
Glama
dan1d

mercadolibre-mcp

search_items

Search MercadoLibre products by keyword, with filters for category, price range, and site (e.g., MLA for Argentina).

Instructions

Search products on MercadoLibre by keyword. Supports filtering by category, price range, and site (MLA=Argentina, MLB=Brazil, MLM=Mexico, etc.)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query
site_idNoSite ID (default: MLA). MLA=Argentina, MLB=Brazil, MLM=Mexico, MLC=Chile, MCO=Colombia
categoryNoCategory ID to filter
price_minNoMinimum price
price_maxNoMaximum price
limitNoMax results (default 10, max 50)
offsetNoPagination offset

Implementation Reference

  • The actual implementation of the search_items tool. It builds query parameters (site_id, query, category, price_min, price_max, limit, offset) and calls the MercadoLibre API endpoint /sites/{siteId}/search.
    export async function searchItems(
      client: MercadoLibreClient,
      params: SearchItemsParams
    ): Promise<unknown> {
      const siteId = params.site_id ?? "MLA";
      const qp: Record<string, string> = { q: params.query };
      if (params.category) qp.category = params.category;
      if (params.price_min !== undefined) qp.price_min = String(params.price_min);
      if (params.price_max !== undefined) qp.price_max = String(params.price_max);
      qp.limit = String(Math.min(params.limit ?? 10, 50));
      if (params.offset !== undefined) qp.offset = String(params.offset);
      return client.get(`/sites/${encodeURIComponent(siteId)}/search`, qp);
    }
  • TypeScript interface defining the input parameters for search_items: query (required), site_id, category, price_min, price_max, limit, offset (all optional).
    export interface SearchItemsParams {
      query: string;
      site_id?: string;
      category?: string;
      price_min?: number;
      price_max?: number;
      limit?: number;
      offset?: number;
    }
  • Registration of the search_items tool with the MCP server. Defines the tool name, description, Zod schemas for input validation, and the handler that calls tools.search_items and formats the response.
    server.tool(
      "search_items",
      "Search products on MercadoLibre by keyword. Supports filtering by category, price range, and site (MLA=Argentina, MLB=Brazil, MLM=Mexico, etc.)",
      {
        query: z.string().describe("Search query"),
        site_id: z.string().optional().describe("Site ID (default: MLA). MLA=Argentina, MLB=Brazil, MLM=Mexico, MLC=Chile, MCO=Colombia"),
        category: z.string().optional().describe("Category ID to filter"),
        price_min: z.number().optional().describe("Minimum price"),
        price_max: z.number().optional().describe("Maximum price"),
        limit: z.number().optional().describe("Max results (default 10, max 50)"),
        offset: z.number().optional().describe("Pagination offset"),
      },
      async (params) => {
        try {
          const result = await tools.search_items(params);
          return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
        } catch (error) {
          const message = error instanceof Error ? error.message : String(error);
          return { content: [{ type: "text", text: message }], isError: true };
        }
      },
    );
  • The createMercadoLibreTools factory creates a client and exposes a tools object where search_items is mapped to call the searchItems action with the client already bound.
    return {
      tools: {
        search_items: (params: SearchItemsParams) => searchItems(client, params),
  • Zod schema definitions for the search_items tool's input validation (query, site_id, category, price_min, price_max, limit, offset).
    {
      query: z.string().describe("Search query"),
      site_id: z.string().optional().describe("Site ID (default: MLA). MLA=Argentina, MLB=Brazil, MLM=Mexico, MLC=Chile, MCO=Colombia"),
      category: z.string().optional().describe("Category ID to filter"),
      price_min: z.number().optional().describe("Minimum price"),
      price_max: z.number().optional().describe("Maximum price"),
      limit: z.number().optional().describe("Max results (default 10, max 50)"),
      offset: z.number().optional().describe("Pagination offset"),
    },
Behavior2/5

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

With no annotations, the description carries the full burden. It indicates a read-only search but does not disclose any side effects, authentication requirements, rate limits, or behavior around empty results. The description adds minimal behavioral context beyond the core purpose.

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 a single sentence that front-loads the core action ('Search products') and then lists supported filters. It is concise with no wasted words, though it could be slightly restructured for readability.

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

Completeness2/5

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

For a search tool with 7 parameters and no output schema, the description is insufficient. It does not mention response format, pagination behavior beyond limit/offset, error handling, or common usage patterns. The description leaves significant gaps for an AI to fully understand the tool's behavior.

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?

Input schema has 100% description coverage for parameters, so the baseline is 3. The description adds example site IDs (MLA, MLB, etc.) but this is already partially covered in the schema. No significant new meaning is added beyond the schema.

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 'Search products on MercadoLibre by keyword', providing a specific verb and resource. It also mentions filtering by category, price range, and site, distinguishing it from sibling tools like get_item or get_categories, which are for single item retrieval or category listing.

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

Usage Guidelines3/5

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

The description explains what the tool does and mentions supported filters, but does not explicitly state when to use it versus alternatives (e.g., using get_item for a specific product). The context is implied but no exclusion or alternative guidance is provided.

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/dan1d/mercadolibre-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server