Skip to main content
Glama

get_categories

Retrieve the category tree structure from a product catalog to organize and navigate product hierarchies in SAP Commerce Cloud.

Instructions

Get the category tree from the product catalog

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The implementation of the getCategories method that fetches the category tree from the Hybris OCC API.
    async getCategories(): Promise<Category[]> {
      interface CatalogResponse {
        catalogs: Array<{
          id: string;
          catalogVersions: Array<{
            id: string;
            categories: Category[];
          }>;
        }>;
      }
    
      const result = await this.request<CatalogResponse>(
        `/occ/v2/${encodeURIComponent(this.config.baseSiteId!)}/catalogs`
      );
    
      // Extract categories from the first catalog version matching our config
      const catalog = result.catalogs?.find(c => c.id === this.config.catalogId);
      if (!catalog) return [];
    
      const version = catalog.catalogVersions?.find(v => v.id === this.config.catalogVersion);
      return version?.categories || [];
    }
  • The handler logic in index.ts that routes the "get_categories" tool call to the hybrisClient.getCategories method.
    case 'get_categories':
      result = await hybrisClient.getCategories();
      break;
  • src/index.ts:141-147 (registration)
    Tool definition for "get_categories" registered in the tools array.
      name: 'get_categories',
      description: 'Get the category tree from the product catalog',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.2/5.0
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure but offers minimal information. It states what the tool does but doesn't describe how it behaves: no mention of response format (e.g., tree structure, JSON hierarchy), performance characteristics, error conditions, or whether it's idempotent. For a read operation with zero annotation coverage, this leaves significant gaps in understanding the tool's behavior.

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

Conciseness5/5

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

The description is a single, efficient sentence that communicates the core purpose without unnecessary words. It's front-loaded with the essential information ('Get the category tree') and specifies the source ('from the product catalog'). Every word earns its place, making it maximally concise while remaining clear.

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 simplicity (zero parameters, no output schema, no annotations), the description is minimally adequate. It tells the agent what the tool does but doesn't provide enough context about the return value format or how the category tree is structured. For a tool that presumably returns hierarchical data, more information about the output would be helpful, though the absence of an output schema means the description should ideally compensate more than it does.

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 tool has zero parameters, and the input schema has 100% description coverage (though empty). The description appropriately doesn't discuss parameters since none exist. It correctly focuses on the tool's purpose rather than attempting to document non-existent inputs, earning a high baseline score for parameter semantics in this specific case.

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 action ('Get') and resource ('category tree from the product catalog'), making the tool's purpose immediately understandable. It distinguishes itself from siblings like 'get_category' (singular) by implying it retrieves the entire hierarchical structure rather than a single category. However, it doesn't explicitly contrast with other catalog-related tools like 'search_products' or 'trigger_catalog_sync'.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when this tool is appropriate compared to 'get_category' (for individual categories), 'search_products' (for product-focused queries), or 'trigger_catalog_sync' (for updating catalog data). There's also no indication of prerequisites, dependencies, or typical use cases.

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