get_item
Retrieve comprehensive details for a MercadoLibre item, including price, pictures, seller info, condition, and stock.
Instructions
Get full details of a MercadoLibre item including title, price, pictures, seller, condition, and stock.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| item_id | Yes | Item ID (e.g. MLA1234567890) |
Implementation Reference
- src/actions.ts:27-32 (handler)Core handler: calls MercadoLibre API GET /items/{item_id} to fetch item details.
export async function getItem( client: MercadoLibreClient, params: GetItemParams ): Promise<unknown> { return client.get(`/items/${encodeURIComponent(params.item_id)}`); } - src/schemas.ts:11-13 (schema)Input schema: expects a string item_id parameter.
export interface GetItemParams { item_id: string; } - src/mcp-server.ts:36-51 (registration)Registration: MCP tool registration with Zod schema validation and error handling.
server.tool( "get_item", "Get full details of a MercadoLibre item including title, price, pictures, seller, condition, and stock.", { item_id: z.string().describe("Item ID (e.g. MLA1234567890)"), }, async (params) => { try { const result = await tools.get_item(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:26-38 (helper)Helper bridge: wraps the getItem action with a client and exposes it as get_item in the tools object.
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), }, }; }