get_category
Retrieve category details including name, hierarchical path, and subcategories for MercadoLibre marketplace products using category ID.
Instructions
Get category details including name, path from root, and children categories.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category_id | Yes | Category ID (e.g. MLA1055) |
Implementation Reference
- src/actions.ts:49-54 (handler)The getCategory handler function that executes the tool logic by making an API call to /categories/{category_id}
export async function getCategory( client: MercadoLibreClient, params: GetCategoryParams ): Promise<unknown> { return client.get(`/categories/${encodeURIComponent(params.category_id)}`); } - src/mcp-server.ts:87-102 (registration)Registration of the get_category tool with the MCP server, including the schema definition and handler invocation
server.tool( "get_category", "Get category details including name, path from root, and children categories.", { category_id: z.string().describe("Category ID (e.g. MLA1055)"), }, async (params) => { try { const result = await tools.get_category(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/schemas.ts:23-25 (schema)Type definition for GetCategoryParams interface that validates the input parameters
export interface GetCategoryParams { category_id: string; }