get_sfra_categories
Retrieve SFRA document categories with counts and descriptions to understand documentation organization and discover available functionality for Salesforce Commerce Cloud development.
Instructions
Get all available SFRA document categories with counts and descriptions. Use this to understand the organization of SFRA documentation and discover what types of functionality are available. Helpful for exploring the full scope of SFRA capabilities.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The core handler configuration for the 'get_sfra_categories' tool, including the exec function that delegates to SFRAClient.getAvailableCategories() to retrieve available SFRA documentation categories.get_sfra_categories: { defaults: (args: ToolArguments) => args, validate: (_args: ToolArguments, _toolName: string) => { // No validation needed for list operation }, exec: async (_args: ToolArguments, context: ToolExecutionContext) => { const client = context.sfraClient as SFRAClient; return client.getAvailableCategories(); }, logMessage: (_args: ToolArguments) => 'SFRA categories', },
- src/clients/sfra-client.ts:387-410 (helper)The supporting utility method in SFRAClient that implements the logic to compute and return SFRA document categories by scanning available documents, counting per category, and providing descriptions.async getAvailableCategories(): Promise<Array<{category: string; count: number; description: string}>> { const documents = await this.getAvailableDocuments(); const categoryMap = new Map<string, number>(); documents.forEach(doc => { categoryMap.set(doc.category, (categoryMap.get(doc.category) ?? 0) + 1); }); const categoryDescriptions = { 'core': 'Core SFRA classes and modules (Server, Request, Response, QueryString, render)', 'product': 'Product-related models and functionality', 'order': 'Order, cart, billing, shipping, and payment models', 'customer': 'Customer account and address models', 'pricing': 'Pricing and discount models', 'store': 'Store and location models', 'other': 'Other models and utilities', }; return Array.from(categoryMap.entries()).map(([category, count]) => ({ category, count, description: categoryDescriptions[category as keyof typeof categoryDescriptions] || 'Other documentation', })); }
- src/core/tool-definitions.ts:216-223 (schema)The tool schema definition including name, description, and empty input schema (no parameters required).{ name: 'get_sfra_categories', description: 'Get all available SFRA document categories with counts and descriptions. Use this to understand the organization of SFRA documentation and discover what types of functionality are available. Helpful for exploring the full scope of SFRA capabilities.', inputSchema: { type: 'object', properties: {}, }, },
- src/core/server.ts:98-107 (registration)Registration of the SFRAToolHandler in the MCP server, which handles the 'get_sfra_categories' tool along with other SFRA tools.this.handlers = [ new LogToolHandler(context, 'Log'), new JobLogToolHandler(context, 'JobLog'), new DocsToolHandler(context, 'Docs'), new BestPracticesToolHandler(context, 'BestPractices'), new SFRAToolHandler(context, 'SFRA'), new SystemObjectToolHandler(context, 'SystemObjects'), new CodeVersionToolHandler(context, 'CodeVersions'), new CartridgeToolHandler(context, 'Cartridge'), ];
- src/core/handlers/sfra-handler.ts:13-55 (handler)The SFRAToolHandler class that manages SFRA tools, including initialization of SFRAClient, tool dispatch via config, and providing execution context with the client.export class SFRAToolHandler extends BaseToolHandler<SFRAToolName> { private sfraClient: SFRAClient | null = null; constructor(context: HandlerContext, subLoggerName: string) { super(context, subLoggerName); } protected async onInitialize(): Promise<void> { if (!this.sfraClient) { this.sfraClient = new SFRAClient(); this.logger.debug('SFRA client initialized'); } } protected async onDispose(): Promise<void> { this.sfraClient = null; this.logger.debug('SFRA client disposed'); } canHandle(toolName: string): boolean { return SFRA_TOOL_NAMES_SET.has(toolName as SFRAToolName); } protected getToolNameSet(): Set<SFRAToolName> { return SFRA_TOOL_NAMES_SET; } protected getToolConfig(): Record<string, GenericToolSpec<ToolArguments, any>> { return SFRA_TOOL_CONFIG; } protected async createExecutionContext(): Promise<ToolExecutionContext> { if (!this.sfraClient) { throw new Error('SFRA client not initialized'); } return { handlerContext: this.context, logger: this.logger, sfraClient: this.sfraClient, }; } }