Skip to main content
Glama
by sinch
mailgun-service-helper.ts1.42 kB
import { PromptResponse } from '../../../types'; export type MailgunCredentials = { domain: string; apiKey: string; } // TODO: Replace this method with a getMailgunService() method that will return the SinchClient once the Mailgun service is implemented. export const getMailgunCredentials = (domain: string | undefined): MailgunCredentials | PromptResponse => { let credentials: MailgunCredentials | undefined = undefined; const mailgunDomain = domain || process.env.MAILGUN_DOMAIN; const apiKey = process.env.MAILGUN_API_KEY; if (mailgunDomain && apiKey) { credentials = { domain: mailgunDomain, apiKey: apiKey }; } if (!mailgunDomain || !credentials) { let errorMessage = ''; if (!mailgunDomain) { errorMessage = 'The "domain" is not provided and "MAILGUN_DOMAIN" is not set in the environment variables.'; } if (!apiKey) { errorMessage += '"MAILGUN_API_KEY" is not set in the environment variables. The property is required to use the emails related tools.'; } return new PromptResponse(errorMessage); } return credentials; }; export const getMailgunApiKey = (): string | PromptResponse => { const apiKey = process.env.MAILGUN_API_KEY; if (!apiKey) { return new PromptResponse('The "MAILGUN_API_KEY" environment variable is not set. The property is required to use the emails related tools.'); } return apiKey; }

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