Skip to main content
Glama

list_categories

Retrieve a structured list of product categories, including names, item counts, and special markers like discounts or hot items, to easily navigate the CoolPC catalog.

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 main handler function for 'list_categories' tool. It transforms the loaded productData into a structured list of categories including IDs, names, stats, and subcategory counts, then returns it as JSON text 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), }, ], }; }
  • Input schema for the 'list_categories' tool, defining an empty object (no input parameters required).
    inputSchema: { type: "object", properties: {}, },
  • src/index.ts:267-274 (registration)
    Registration of the 'list_categories' tool in the ListToolsRequestHandler response, including name, description, and schema.
    { 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: {}, }, },
  • src/index.ts:319-320 (registration)
    Dispatch/registration case in the CallToolRequestHandler switch statement that invokes the listCategories handler method.
    case "list_categories": return this.listCategories();

Other Tools

Related Tools

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