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();
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses that the tool returns a 'complete list' with statistics, which implies it's a read-only operation without side effects. However, it lacks details on behavioral traits such as pagination, rate limits, authentication needs, or error handling. The description adds some context but misses key operational aspects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and well-structured in two sentences. The first sentence states the purpose and output, and the second provides usage context. Every sentence adds value without waste. It could be slightly more front-loaded by emphasizing the core action first, but overall it's efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (simple list operation with 0 parameters) and no annotations or output schema, the description is moderately complete. It explains what the tool does and its use cases, but it lacks details on the output format (e.g., structure of statistics) and behavioral constraints. For a tool with no structured data support, more completeness is needed to fully guide an agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description does not mention any parameters, which is appropriate. It earns a baseline score of 4 because it avoids redundancy and focuses on the tool's purpose and output, adding value without unnecessary details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get a complete list of all product categories with statistics.' It specifies the verb ('Get') and resource ('product categories'), and lists the data returned (names, counts, markers). However, it does not explicitly distinguish this from sibling tools like 'get_category_products' or 'search_products', which reduces the score from a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides implied usage guidance: 'Useful for browsing available product types or understanding the catalog structure.' This suggests when to use it (for overview purposes), but it does not explicitly state when not to use it or name alternatives among the sibling tools (e.g., use 'search_products' for specific queries). The guidance is helpful but not comprehensive.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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