Skip to main content
Glama
by sinch
mailgun-tools-helper.ts1.75 kB
import { ToolsConfig } from '../../../types'; import { matchesAnyTag } from '../../../utils'; import { ENABLED, toolsStatusMap } from '../../../tools-config'; import { getMailgunApiKey } from './mailgun-service-helper'; import crypto from 'crypto'; const toolsConfig: Record<string, ToolsConfig> = { analyticsMetrics: { name: 'analytics-metrics', tags: ['all', 'email', 'analytics-metrics'], } , listEmailEvents:{ name: 'list-email-events', tags: ['all', 'email', 'list-email-events'], }, listEmailTemplates: { name: 'list-email-templates', tags: ['all', 'email', 'notification', 'list-email-templates'], }, retrieveEmailInfo: { name: 'retrieve-email-info', tags: ['all', 'email', 'notification', 'retrieve-email-info'], }, sendEmail: { name: 'send-email', tags: ['all', 'email', 'notification', 'send-email'], } } export type EmailToolKey = keyof typeof toolsConfig; export const getToolName = (toolKey: EmailToolKey): string => toolsConfig[toolKey].name; export const shouldRegisterTool = (toolKey: string, tags: string[]): boolean => { const filteringTags = toolsConfig[toolKey].tags; const toolName = toolsConfig[toolKey].name; if (!matchesAnyTag(filteringTags, tags)) { toolsStatusMap[toolName] = `The filtering tags don't contain ${filteringTags.join(' or ')}`; return false; } if (typeof getMailgunApiKey() !== 'string') { toolsStatusMap[toolName] = `Incorrect configuration. The environment variable "MAILGUN_API_KEY" is not set.`; return false; } toolsStatusMap[toolName] = ENABLED; return true; } export const sha256 = (str: string): string => { const hash = crypto.createHash('sha256'); hash.update(str); return hash.digest('hex'); }

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/sinch/sinch-mcp-server'

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