Skip to main content
Glama

send-email

Send emails with subject, recipient address, and message body to communicate information or respond to messages through the email management system.

Instructions

Send Email with subject, destination and body

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bodyYesEmail body, min 1 char and max 255 chars
subjectYesEmail subject, min 1 char and max 30 chars
toYesDestination email

Implementation Reference

  • Handler function for the 'send-email' tool. It extracts auth info from request headers, creates an EmailClient instance, calls sendEmail on it, and returns a structured response with success/error status.
    async (params, {requestInfo}) => { const authEmail = { port: requestInfo?.headers["email-port"], email: requestInfo?.headers["email-username"], password: requestInfo?.headers["email-password"], clientType: requestInfo?.headers["email-client-type"], } as AuthEmailType; const emailClient = new EmailClient (authEmail); const result = await emailClient.sendEmail(params); const response = { success: result, error: result ? null : "No hay conexión con el servidor" } return { isError: !result, content: [ { type: "text", text: JSON.stringify(response) }, ], structuredContent: response, };
  • Registers the 'send-email' tool on the MCP server with title, description, annotations, examples, input and output schemas.
    server.registerTool( "send-email", { title: "Send Email", description: "Send Email with subject, destination and body", annotations: { openWorlHint: true, examples: { input: { to: "example@domain.com", subject: "Example Subject", body: "Example Body", }, }, }, inputSchema: SendEmailSchema.shape, outputSchema: OutputSendEmailSchema.shape, },
  • Zod input schema (SendEmailSchema) used by the 'send-email' tool, defining 'to', 'subject', and 'body' fields.
    export const SendEmailSchema = z.object({ to: z.string().email().describe('Destination email'), subject: z. string() .min(1) .max(30) .describe('Email subject, min 1 char and max 30 chars'), body: z. string() .min(1) .max(255). describe('Email body, min 1 char and max 255 chars'), }) export type SendEmailType = z.infer<typeof SendEmailSchema>;
  • Zod output schema (OutputSendEmailSchema) used by the 'send-email' tool, with 'success' boolean and optional 'error' string.
    export const OutputSendEmailSchema = z.object({ success: z.boolean(), error: z.string().nullish(), }); export type OutputSendEmailType = z.infer<typeof OutputSendEmailSchema>;
  • EmailClient.sendEmail helper method called by the tool handler. Currently a mock implementation that returns true randomly.
    sendEmail(params: SendEmailType) { const randonNumber = Math.random(); Logger.info ("Send email", params); return randonNumber > 0.15; }

Other Tools

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/Karopatu/email-management-mcp'

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