UNPKG

@sinch/mcp

Version:

Sinch MCP server

69 lines 2.87 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getMissingEnvironmentVariables = exports.shouldRegisterTool = exports.getToolName = void 0; const utils_1 = require("../../../utils"); const tools_config_1 = require("../../../tools-config"); const defineToolsConfig = (config) => { return config; }; const toolsConfig = defineToolsConfig({ listConversationApps: { name: 'list-conversation-apps', tags: ['all', 'conversation', 'notification', 'list-conversation-apps'], }, listMessagingTemplates: { name: 'list-messaging-templates', tags: ['all', 'conversation', 'notification', 'list-messaging-templates'], }, sendCardOrChoiceMessage: { name: 'send-choice-message', tags: ['all', 'conversation', 'notification', 'send-choice-message'], }, sendLocationMessage: { name: 'send-location-message', tags: ['all', 'conversation', 'notification', 'send-location-message'], }, sendMediaMessage: { name: 'send-media-message', tags: ['all', 'conversation', 'notification', 'send-media-message'], }, sendTemplateMessage: { name: 'send-template-message', tags: ['all', 'conversation', 'notification', 'send-template-message'], }, sendWhatsAppTemplateMessage: { name: 'send-whatsapp-template-message', tags: ['all', 'conversation', 'notification', 'send-whatsapp-template-message'], }, sendTextMessage: { name: 'send-text-message', tags: ['all', 'conversation', 'notification', 'send-text-message'], } }); const getToolName = (toolKey) => toolsConfig[toolKey].name; exports.getToolName = getToolName; const shouldRegisterTool = (toolKey, tags) => { const filteringTags = toolsConfig[toolKey].tags; const toolName = toolsConfig[toolKey].name; if (!(0, utils_1.matchesAnyTag)(filteringTags, tags)) { tools_config_1.toolsStatusMap[toolName] = `The filtering tags don't contain ${filteringTags.join(' or ')}`; return false; } if ((0, exports.getMissingEnvironmentVariables)().length > 0) { tools_config_1.toolsStatusMap[toolName] = `Incorrect configuration. The environment variables are not set: ${(0, exports.getMissingEnvironmentVariables)().join(', ')}`; return false; } tools_config_1.toolsStatusMap[toolName] = tools_config_1.ENABLED; return true; }; exports.shouldRegisterTool = shouldRegisterTool; const getMissingEnvironmentVariables = () => { const requiredEnvVars = [ 'CONVERSATION_PROJECT_ID', 'CONVERSATION_KEY_ID', 'CONVERSATION_KEY_SECRET', ]; return requiredEnvVars.filter((envVar) => !process.env[envVar]); }; exports.getMissingEnvironmentVariables = getMissingEnvironmentVariables; //# sourceMappingURL=conversation-tools-helper.js.map