Skip to main content
Glama
taurgis

SFCC Development MCP Server

by taurgis

get_sfcc_class_info

Retrieve detailed information on SFCC classes, including properties and methods, to aid in API implementation and cartridge development within the dw.* namespace. Essential for understanding class functionality and building features in the SFCC Rhino environment.

Instructions

Get detailed information about an SFCC class including properties, methods, and description. Use this when you need to understand what a specific SFCC class does, what methods/properties are available, or when implementing features that use SFCC APIs. Essential for cartridge development (controllers, scripts, templates, rest-apis) using the dw.* namespace in the SFCC Rhino environment.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
classNameYesThe SFCC class name (e.g., 'Catalog', 'dw.catalog.Catalog')
expandNoWhether to include detailed information about referenced types used by this class (default: false)

Implementation Reference

  • Core handler implementation for get_sfcc_class_info tool: fetches and parses SFCC class documentation, applies user-specified filters (includeDescription, constants, properties, methods, inheritance), performs search filtering if provided, caches results, and optionally expands details for referenced types.
    async getClassDetailsExpanded( className: string, expand: boolean = false, filterOptions?: ClassDetailsFilterOptions, ): Promise<SFCCClassDetails & { referencedTypes?: SFCCClassDetails[] } | null> { // Set default filter options const filters = { includeDescription: filterOptions?.includeDescription ?? true, includeConstants: filterOptions?.includeConstants ?? true, includeProperties: filterOptions?.includeProperties ?? true, includeMethods: filterOptions?.includeMethods ?? true, includeInheritance: filterOptions?.includeInheritance ?? true, search: filterOptions?.search, }; // Check cache first for expanded details with filter options const cacheKey = `details-expanded:${className}:${expand}:${JSON.stringify(filters)}`; const cachedResult = this.cacheManager.getClassDetails(cacheKey); if (cachedResult !== undefined) { return cachedResult; } const classDetails = await this.getClassDetails(className); if (!classDetails) { this.cacheManager.setClassDetails(cacheKey, null); return null; } // Apply filtering and search to the class details const filteredDetails = this.applyFiltersAndSearch(classDetails, filters); if (!expand) { this.cacheManager.setClassDetails(cacheKey, filteredDetails); return filteredDetails; } // Get the raw content to extract referenced types const content = await this.getClassDocumentation(className); if (!content) { this.cacheManager.setClassDetails(cacheKey, filteredDetails); return filteredDetails; } const referencedTypeNames = ReferencedTypesExtractor.extractFilteredReferencedTypes(content, className); const referencedTypes: SFCCClassDetails[] = []; // Get details for each referenced type for (const typeName of referencedTypeNames) { try { const typeDetails = await this.getClassDetails(typeName); if (typeDetails) { referencedTypes.push(typeDetails); } } catch { // Silently skip types that can't be found this.logger.warn(`Could not find details for referenced type: ${typeName}`); } } const result = { ...filteredDetails, referencedTypes: referencedTypes.length > 0 ? referencedTypes : undefined, }; // Cache the result this.cacheManager.setClassDetails(cacheKey, result); return result; }
  • Input schema definition for the get_sfcc_class_info tool, including all parameters, descriptions, defaults, and validation requirements.
    { name: 'get_sfcc_class_info', description: 'Get detailed information about an SFCC class including properties, methods, and description. Use this when you need to understand what a specific SFCC class does, what methods/properties are available, or when implementing features that use SFCC APIs. Essential for cartridge development (controllers, scripts, templates, rest-apis) using the dw.* namespace in the SFCC Rhino environment.', inputSchema: { type: 'object', properties: { className: { type: 'string', description: "The SFCC class name (e.g., 'Catalog', 'dw.catalog.Catalog')", }, expand: { type: 'boolean', description: 'Whether to include detailed information about referenced types used by this class (default: false)', default: false, }, includeDescription: { type: 'boolean', description: 'Whether to include the class description in the response (default: true)', default: true, }, includeConstants: { type: 'boolean', description: 'Whether to include constants in the response (default: true)', default: true, }, includeProperties: { type: 'boolean', description: 'Whether to include properties in the response (default: true)', default: true, }, includeMethods: { type: 'boolean', description: 'Whether to include methods in the response (default: true)', default: true, }, includeInheritance: { type: 'boolean', description: 'Whether to include inheritance hierarchy in the response (default: true)', default: true, }, search: { type: 'string', description: 'Optional search term to filter constants, properties, methods, and inheritance entries. Case-insensitive search across names and descriptions. Only one word at a time (e.g., "get", "create", "order"). Combining multiple words or looking for multiple items at the same time is not supported.', }, }, required: ['className'], }, },
  • Tool registration configuration: sets defaults, validation (requires className), execution handler (calls SFCCDocumentationClient.getClassDetailsExpanded), and logging message.
    get_sfcc_class_info: { defaults: (args: ToolArguments) => ({ ...args, expand: args.expand ?? false, includeDescription: args.includeDescription ?? true, includeConstants: args.includeConstants ?? true, includeProperties: args.includeProperties ?? true, includeMethods: args.includeMethods ?? true, includeInheritance: args.includeInheritance ?? true, search: args.search ?? undefined, }), validate: (args: ToolArguments, toolName: string) => { ValidationHelpers.validateArguments(args, CommonValidations.requiredString('className'), toolName); }, exec: async (args: ToolArguments, context: ToolExecutionContext) => { const client = context.docsClient as SFCCDocumentationClient; const result = await client.getClassDetailsExpanded( args.className as string, args.expand as boolean, { includeDescription: args.includeDescription as boolean, includeConstants: args.includeConstants as boolean, includeProperties: args.includeProperties as boolean, includeMethods: args.includeMethods as boolean, includeInheritance: args.includeInheritance as boolean, search: args.search as string | undefined, }, ); if (!result) { throw new Error(`Class "${args.className}" not found`); } return result; }, logMessage: (args: ToolArguments) => `Class info ${args.className} expand=${args.expand ?? false} ${args.search ? `search="${args.search}"` : ''}`, },
  • MCP server registration: includes SFCC_DOCUMENTATION_TOOLS (containing get_sfcc_class_info schema) in the listTools response for tool discovery.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => { const tools = []; // Always available tools tools.push(...SFCC_DOCUMENTATION_TOOLS); tools.push(...BEST_PRACTICES_TOOLS); tools.push(...SFRA_DOCUMENTATION_TOOLS); tools.push(...CARTRIDGE_GENERATION_TOOLS); // Conditional tools based on available capabilities if (this.capabilities.canAccessLogs) { tools.push(...LOG_TOOLS); tools.push(...JOB_LOG_TOOLS); } if (this.capabilities.canAccessOCAPI) { tools.push(...SYSTEM_OBJECT_TOOLS); tools.push(...CODE_VERSION_TOOLS); } return { tools }; });
  • DocsToolHandler class that initializes SFCCDocumentationClient, checks if it can handle documentation tools, provides tool config (including get_sfcc_class_info), and execution context with client.
    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, }; } }

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/taurgis/sfcc-dev-mcp'

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