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: {},
      },
    },

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/mcieunic/hybris-mcp-main'

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