Skip to main content
Glama
newerton

Mercado Livre MCP Server

get-produtos

Retrieve basic product information from the Mercado Livre MCP Server by providing an array of product names for efficient data lookup.

Instructions

Buscar informações básicas de produtos

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
productsYesArray of product names

Implementation Reference

  • Registers the MCP tool 'get-produtos' with description, input schema, and an inline async handler that delegates to MercadoLivreService.getProducts and formats the response as 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 input schema defining 'products' as an array of strings.
    { products: z.array(z.string()).describe('Array of product names'), },
  • Core handler logic in MercadoLivreService.getProducts: initializes, fetches items via crawler for the first product, gets 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; }
  • Helper method to filter products with free shipping, copy relevant fields, sort by price ascending, and return the list.
    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; };

Other Tools

Related 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