search_sfcc_methods
Find SFCC methods by name to locate classes or discover similar operations across the platform's API documentation.
Instructions
Search for methods across all SFCC classes by method name. Use this when you know the method name but not which class it belongs to, or when looking for similar methods across different classes. Helpful for discovering all available methods that perform similar operations.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| methodName | Yes | Method name to search for. Only use one word at a time (e.g., "get", "create", "update"). Combining multiple words or looking for multiple methods at the same time is not supported. |
Implementation Reference
- The tool configuration defining the handler (exec function), validation, defaults, and logging for 'search_sfcc_methods'. The exec function extracts the methodName argument and calls SFCCDocumentationClient.searchMethods.search_sfcc_methods: { defaults: (args: ToolArguments) => args, validate: (args: ToolArguments, toolName: string) => { ValidationHelpers.validateArguments(args, CommonValidations.requiredString('methodName'), toolName); }, exec: async (args: ToolArguments, context: ToolExecutionContext) => { const client = context.docsClient as SFCCDocumentationClient; return client.searchMethods(args.methodName as string); }, logMessage: (args: ToolArguments) => `Search methods ${args.methodName}`, },
- src/clients/docs-client.ts:303-331 (helper)Core implementation of method search: initializes docs, checks cache, iterates over all classes, parses details, finds matching methods by name (case-insensitive substring match), caches results.async searchMethods(methodName: string): Promise<{ className: string; method: SFCCMethod }[]> { await this.initialize(); // Check cache first const cacheKey = `search:methods:${methodName.toLowerCase()}`; const cachedResult = this.cacheManager.getMethodSearch(cacheKey); if (cachedResult) { return cachedResult; } const results: { className: string; method: SFCCMethod }[] = []; for (const [fullClassName] of this.classCache) { const details = await this.getClassDetails(fullClassName); const methods = details?.methods ?? []; for (const method of methods) { if (method.name.toLowerCase().includes(methodName.toLowerCase())) { results.push({ className: fullClassName, method, }); } } } // Cache the search results this.cacheManager.setMethodSearch(cacheKey, results); return results; }
- src/core/tool-definitions.ts:71-84 (schema)Defines the input schema, description, and metadata for the 'search_sfcc_methods' tool used in MCP tool listing.{ name: 'search_sfcc_methods', description: 'Search for methods across all SFCC classes by method name. Use this when you know the method name but not which class it belongs to, or when looking for similar methods across different classes. Helpful for discovering all available methods that perform similar operations.', inputSchema: { type: 'object', properties: { methodName: { type: 'string', description: 'Method name to search for. Only use one word at a time (e.g., "get", "create", "update"). Combining multiple words or looking for multiple methods at the same time is not supported.', }, }, required: ['methodName'], }, },
- src/core/server.ts:98-107 (registration)Registers the DocsToolHandler instance, which handles the 'search_sfcc_methods' tool (among other documentation tools) by delegating to tool-specific configs.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'), ];