Skip to main content
Glama

send-email

Send emails with subject, recipient, and body content through the Email Management MCP Server.

Instructions

Send Email with subject, destination and body

Input Schema

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

Implementation Reference

  • Handler function registered for the 'send-email' tool. It constructs auth from headers, instantiates EmailClient, calls sendEmail, and returns structured response with success/error.
    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, };
  • Zod input schema (SendEmailSchema) defining parameters for send-email tool: to, subject, body with validations.
    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) for send-email tool response: 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>;
  • MCP tool registration call for 'send-email' specifying title, description, annotations, input/output schemas, and handler function.
    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, }, 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, }; });
  • Supporting method in EmailClient class that implements the email sending logic (mock implementation using random success). Called by the tool handler.
    sendEmail(params: SendEmailType) { const randonNumber = Math.random(); Logger.info ("Send email", params); return randonNumber > 0.15; }
Install Server

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