Skip to main content
Glama
newerton

Mercado Livre MCP Server

get-produtos

Retrieve basic product information from Mercado Livre by providing product names as input.

Instructions

Buscar informações básicas de produtos

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
productsYesArray of product names

Implementation Reference

  • Registers the 'get-produtos' MCP tool with input schema (array of product names), description, and an inline handler that fetches product info via MercadoLivreService.getProducts and returns it as formatted JSON text.
    private registerGetStockToolHandler(): void {
      this.server.tool(
        'get-produtos',
        'Buscar informações básicas de produtos',
        {
          products: z.array(z.string()).describe('Array of product names'),
        },
        async ({ products }) => {
          const infos = await this.service.getProducts(products);
    
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify(infos, null, 2),
              },
            ],
          };
        },
      );
    }
  • Zod schema defining the input parameters for the 'get-produtos' tool: an array of product names.
    {
      products: z.array(z.string()).describe('Array of product names'),
    },
  • Core implementation of product fetching: resets state, crawls Mercado Livre for the first product using getItems, computes lowest value items, and returns them.
    async getProducts(products: string[]) {
      // const data = [];
      // for (const product of products) {
      this.page = 1;
      this.products = [];
    
      await this.getItems(products[0]);
      const lowestValueItem = this.getLowestValueItem();
    
      // data.push(lowestValueItem);
      // }
      return lowestValueItem;
    }
  • Parses HTML content from Mercado Livre search results using Cheerio, extracts product details (name, price, URL, shipping), matches against query with minimum 80% ratio, and collects matching products.
    private parseHTML = (product: string): void => {
      const $ = this.pageContent;
      if (!$) {
        console.error('Error parsing HTML: No content available');
        return;
      }
    
      const uiSearchLayoutItem = this.layoutItems();
    
      if (uiSearchLayoutItem) {
        uiSearchLayoutItem.each((_, element) => {
          const uiSearchItemTitle = $(element)
            .find('div[class="poly-card__content"] h3')
            .text();
          const productOriginalName = voca(uiSearchItemTitle).trim().value();
          const price = this.getPrice(element);
    
          const matching = wordsMatching({
            originalName: productOriginalName,
            querySearchByFilter: product,
            price,
            debug: false,
          });
    
          if (matching.queryMatchRatio >= 0.8) {
            if (price) {
              const productUrl = this.getUrl(element);
              const shippings = this.getShippings(element);
    
              this.products.push({
                name: productOriginalName,
                price,
                queryMatchRatio: matching.queryMatchRatio,
                url: productUrl,
                shippings,
              });
            }
          }
        });
      }
    };
  • Filters products with free shipping, copies relevant fields, sorts by price ascending, and returns the list of lowest value items.
    private getLowestValueItem = (): MercadoLivreCrawlerOutput[] => {
      const items: MercadoLivreCrawlerOutput[] = [];
    
      this.getFreeShipping();
      for (const product of this.products) {
        items.push({
          name: product.name,
          price: product.price,
          queryMatchRatio: product.queryMatchRatio,
          url: product.url,
          shippings: product.shippings,
        });
      }
    
      items.sort((a, b) => a.price - b.price);
    
      return items;
    };
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states the tool searches for basic product information, but doesn't disclose behavioral traits like whether it's read-only, requires authentication, has rate limits, or what happens with invalid inputs. This leaves significant gaps in understanding how the tool behaves.

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, efficient sentence in Portuguese ('Buscar informações básicas de produtos') that's appropriately sized and front-loaded. There's no wasted text, though it could be slightly more informative without losing conciseness.

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?

Given no annotations, no output schema, and a simple input schema, the description is incomplete. It doesn't explain what 'basic information' includes, how results are returned, or any error handling, making it inadequate for a tool that presumably returns data based on product names.

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, with the 'products' parameter documented as 'Array of product names'. The description adds no additional meaning beyond this, so it meets the baseline of 3 where the schema does the heavy lifting, but doesn't compensate or enhance parameter understanding.

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

Purpose3/5

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

The description 'Buscar informações básicas de produtos' (Search for basic product information) states a clear verb ('Buscar') and resource ('produtos'), but it's vague about what constitutes 'basic information' and doesn't specify scope or format. Without sibling tools, differentiation isn't needed, but the purpose remains somewhat ambiguous.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool—there's no mention of prerequisites, alternatives, or specific contexts. The description implies it's for searching product info, but offers no further usage instructions, leaving the agent to infer appropriate scenarios.

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/newerton/mcp-mercado-livre'

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