sfcc-dev-mcp
Version: 
MCP server for Salesforce B2C Commerce Cloud development assistance including logs, debugging, and development tools
59 lines • 2.36 kB
JavaScript
import { ValidationHelpers, CommonValidations } from '../core/handlers/validation-helpers.js';
export const BEST_PRACTICE_TOOL_NAMES = [
    'get_available_best_practice_guides',
    'get_best_practice_guide',
    'search_best_practices',
    'get_hook_reference',
];
export const BEST_PRACTICE_TOOL_NAMES_SET = new Set(BEST_PRACTICE_TOOL_NAMES);
/**
 * Configuration for SFCC best practices tools
 * Maps each tool to its validation, execution, and messaging logic
 */
export const BEST_PRACTICES_TOOL_CONFIG = {
    get_available_best_practice_guides: {
        defaults: (args) => args,
        validate: (_args, _toolName) => {
            // No validation needed for list operation
        },
        exec: async (_args, context) => {
            const client = context.bestPracticesClient;
            return client.getAvailableGuides();
        },
        logMessage: (_args) => 'List guides',
    },
    get_best_practice_guide: {
        defaults: (args) => args,
        validate: (args, toolName) => {
            ValidationHelpers.validateArguments(args, CommonValidations.requiredString('guideName'), toolName);
        },
        exec: async (args, context) => {
            const client = context.bestPracticesClient;
            return client.getBestPracticeGuide(args.guideName);
        },
        logMessage: (args) => `Guide ${args.guideName}`,
    },
    search_best_practices: {
        defaults: (args) => args,
        validate: (args, toolName) => {
            ValidationHelpers.validateArguments(args, CommonValidations.requiredString('query'), toolName);
        },
        exec: async (args, context) => {
            const client = context.bestPracticesClient;
            return client.searchBestPractices(args.query);
        },
        logMessage: (args) => `Search best practices ${args.query}`,
    },
    get_hook_reference: {
        defaults: (args) => args,
        validate: (args, toolName) => {
            ValidationHelpers.validateArguments(args, CommonValidations.requiredString('guideName'), toolName);
        },
        exec: async (args, context) => {
            const client = context.bestPracticesClient;
            return client.getHookReference(args.guideName);
        },
        logMessage: (args) => `Hook reference ${args.guideName}`,
    },
};
//# sourceMappingURL=best-practices-tool-config.js.map