sfcc-dev-mcp
Version:
MCP server for Salesforce B2C Commerce Cloud development assistance including logs, debugging, and development tools
43 lines • 1.41 kB
JavaScript
import { BaseToolHandler } from './base-handler.js';
import { SFCCDocumentationClient } from '../../clients/docs-client.js';
import { DOCS_TOOL_CONFIG, DOC_TOOL_NAMES_SET } from '../../tool-configs/docs-tool-config.js';
/**
* Handler for SFCC documentation tools using config-driven dispatch
* Provides access to SFCC class information, search, and documentation
*/
export class DocsToolHandler extends BaseToolHandler {
docsClient = null;
constructor(context, subLoggerName) {
super(context, subLoggerName);
}
async onInitialize() {
if (!this.docsClient) {
this.docsClient = new SFCCDocumentationClient();
this.logger.debug('Documentation client initialized');
}
}
async onDispose() {
this.docsClient = null;
this.logger.debug('Documentation client disposed');
}
canHandle(toolName) {
return DOC_TOOL_NAMES_SET.has(toolName);
}
getToolNameSet() {
return DOC_TOOL_NAMES_SET;
}
getToolConfig() {
return DOCS_TOOL_CONFIG;
}
async createExecutionContext() {
if (!this.docsClient) {
throw new Error('Documentation client not initialized');
}
return {
handlerContext: this.context,
logger: this.logger,
docsClient: this.docsClient,
};
}
}
//# sourceMappingURL=docs-handler.js.map