Skip to main content
Glama

list_categories

Retrieve all product categories with statistics including names, product counts, and special markers to browse available product types and understand catalog structure.

Instructions

Get a complete list of all product categories with statistics. Shows category names, product counts, and special markers (hot items, discounts). Useful for browsing available product types or understanding the catalog structure.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function that implements the list_categories tool. It processes this.productData to generate a list of categories with their IDs, names, stats, and subcategory product counts, returning a standardized MCP response with JSON content.
    private listCategories() { const categories = this.productData.map(cat => ({ category_id: cat.category_id, category_name: cat.category_name, stats: cat.stats, subcategories: cat.subcategories.map(subcat => ({ name: subcat.name, product_count: subcat.products.length })) })); return { content: [ { type: "text", text: JSON.stringify({ total_categories: categories.length, categories, }, null, 2), }, ], }; }
  • src/index.ts:267-274 (registration)
    Tool registration entry in the tools array passed to server.setTools(). Includes name, description, and empty input schema (no parameters required).
    { name: "list_categories", description: "Get a complete list of all product categories with statistics. Shows category names, product counts, and special markers (hot items, discounts). Useful for browsing available product types or understanding the catalog structure.", inputSchema: { type: "object", properties: {}, }, },
  • Input schema definition for list_categories tool: an empty object since the tool takes no parameters.
    inputSchema: { type: "object", properties: {}, },
  • src/index.ts:319-320 (registration)
    Dispatch case in the CallToolRequestSchema handler switch statement that routes calls to list_categories to the listCategories() method.
    case "list_categories": return this.listCategories();

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/shyuan/coolpc-mcp-server'

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