search_sfcc_classes
Search for Salesforce B2C Commerce Cloud classes by name or functionality to quickly locate relevant APIs or explore feature-related classes. Ideal for finding classes when the exact name is unknown.
Instructions
Search for SFCC classes by name or functionality. Use this when you know part of a class name or need to find classes related to specific functionality (e.g., search 'catalog' to find catalog-related classes). Perfect starting point when you're unsure of the exact class name or exploring available APIs for a feature area.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query for class names. Only use one word at a time (e.g., "catalog", "order", "customer"). Combining multiple words or attempting to look for multiple classes at the same time is not supported. |
Implementation Reference
- src/clients/docs-client.ts:82-101 (handler)Core handler implementation for the 'search_sfcc_classes' tool. Initializes documentation cache if needed, checks cache for prior searches, filters class names case-insensitively containing the query, sorts alphabetically, formats to official names, caches results, and returns matching classes.async searchClasses(query: string): Promise<string[]> { await this.initialize(); // Check cache first const cacheKey = `search:classes:${query.toLowerCase()}`; const cachedResult = this.cacheManager.getSearchResults(cacheKey); if (cachedResult) { return cachedResult; } const lowercaseQuery = query.toLowerCase(); const results = Array.from(this.classCache.keys()) .filter(className => className.toLowerCase().includes(lowercaseQuery)) .sort() .map(className => ClassNameResolver.toOfficialFormat(className)); // Cache the results this.cacheManager.setSearchResults(cacheKey, results); return results; }
- src/tool-configs/docs-tool-config.ts:59-69 (registration)Tool registration configuration for 'search_sfcc_classes', including defaults, input validation (requires 'query'), execution handler that delegates to SFCCDocumentationClient.searchClasses, and logging.search_sfcc_classes: { defaults: (args: ToolArguments) => args, validate: (args: ToolArguments, toolName: string) => { ValidationHelpers.validateArguments(args, CommonValidations.requiredString('query'), toolName); }, exec: async (args: ToolArguments, context: ToolExecutionContext) => { const client = context.docsClient as SFCCDocumentationClient; return client.searchClasses(args.query as string); }, logMessage: (args: ToolArguments) => `Search classes ${args.query}`, },
- src/core/tool-definitions.ts:57-70 (schema)MCP tool schema definition for 'search_sfcc_classes', specifying name, description, and input schema requiring a single 'query' string parameter.{ name: 'search_sfcc_classes', description: "Search for SFCC classes by name or functionality. Use this when you know part of a class name or need to find classes related to specific functionality (e.g., search 'catalog' to find catalog-related classes). Perfect starting point when you're unsure of the exact class name or exploring available APIs for a feature area.", inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query for class names. Only use one word at a time (e.g., "catalog", "order", "customer"). Combining multiple words or attempting to look for multiple classes at the same time is not supported.', }, }, required: ['query'], }, },
- src/core/handlers/docs-handler.ts:9-50 (registration)DocsToolHandler class registers all documentation tools including 'search_sfcc_classes' via config-driven dispatch. Initializes SFCCDocumentationClient, checks if it can handle the tool name, provides tool config and execution context with client instance.export class DocsToolHandler extends BaseToolHandler<DocToolName> { private docsClient: SFCCDocumentationClient | null = null; constructor(context: HandlerContext, subLoggerName: string) { super(context, subLoggerName); } protected async onInitialize(): Promise<void> { if (!this.docsClient) { this.docsClient = new SFCCDocumentationClient(); this.logger.debug('Documentation client initialized'); } } protected async onDispose(): Promise<void> { this.docsClient = null; this.logger.debug('Documentation client disposed'); } canHandle(toolName: string): boolean { return DOC_TOOL_NAMES_SET.has(toolName as DocToolName); } protected getToolNameSet(): Set<DocToolName> { return DOC_TOOL_NAMES_SET; } protected getToolConfig(): Record<string, GenericToolSpec<ToolArguments, any>> { return DOCS_TOOL_CONFIG; } protected async createExecutionContext(): Promise<ToolExecutionContext> { if (!this.docsClient) { throw new Error('Documentation client not initialized'); } return { handlerContext: this.context, logger: this.logger, docsClient: this.docsClient, }; }