Skip to main content
Glama
dan1d

mercadolibre-mcp

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
NameRequiredDescriptionDefault
category_idYesCategory ID (e.g. MLA1055)

Implementation Reference

  • 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)}`);
    }
  • 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 };
        }
      },
    );
  • Type definition for GetCategoryParams interface that validates the input parameters
    export interface GetCategoryParams {
      category_id: string;
    }

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/dan1d/mercadolibre-mcp'

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