get_trends
Fetch current trending searches on MercadoLibre for a specific site. Use this data to understand market demand and align product offerings.
Instructions
Get current trending searches on MercadoLibre for a specific site/country.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| site_id | No | Site ID (default: MLA) |
Implementation Reference
- src/actions.ts:63-69 (handler)The actual handler function that executes the tool logic: calls client.get on /trends/{siteId} endpoint.
export async function getTrends( client: MercadoLibreClient, params?: GetTrendsParams ): Promise<unknown> { const siteId = params?.site_id ?? "MLA"; return client.get(`/trends/${encodeURIComponent(siteId)}`); } - src/schemas.ts:31-33 (schema)Input schema/type definition for GetTrendsParams (optional site_id).
export interface GetTrendsParams { site_id?: string; } - src/mcp-server.ts:121-136 (registration)MCP server tool registration using server.tool() with name 'get_trends', description, Zod schema, and handler that calls tools.get_trends.
server.tool( "get_trends", "Get current trending searches on MercadoLibre for a specific site/country.", { site_id: z.string().optional().describe("Site ID (default: MLA)"), }, async (params) => { try { const result = await tools.get_trends(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 }; } }, ); - src/index.ts:23-37 (helper)Helper/export that wraps getTrends with a bound client, exposed via createMercadoLibreTools().
export function createMercadoLibreTools(accessToken?: string) { const client = new MercadoLibreClient(accessToken); return { tools: { search_items: (params: SearchItemsParams) => searchItems(client, params), get_item: (params: GetItemParams) => getItem(client, params), get_item_description: (params: GetItemDescriptionParams) => getItemDescription(client, params), get_categories: (params?: GetCategoriesParams) => getCategories(client, params), get_category: (params: GetCategoryParams) => getCategory(client, params), get_seller_info: (params: GetSellerInfoParams) => getSellerInfo(client, params), get_trends: (params?: GetTrendsParams) => getTrends(client, params), get_currency_conversion: (params: GetCurrencyConversionParams) => getCurrencyConversion(client, params), }, };