send-email
Send customizable emails by specifying recipient, subject, and body directly through the MCP server for efficient communication within meme generation workflows.
Instructions
Send an email
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | Yes | The body of the email | |
| subject | Yes | The subject of the email | |
| to | Yes | The email address of the recipient |
Implementation Reference
- src/tools.ts:83-117 (handler)The async handler function for the 'send-email' tool. It uses VercelAIToolSet's executeAction to send an email via Gmail by calling the 'GMAIL_SEND_EMAIL' action with the provided arguments (to, subject, body). Returns success or error messages.}, async (args, extra) => { try { const userAddress = "default-user"; const result = await toolset.executeAction({ action: "GMAIL_SEND_EMAIL", entityId: userAddress, params: args }); if (result.successful) { return { content: [{ type: "text", text: `✅ Email sent successfully!\n\nTo: ${args.to}\nSubject: ${args.subject}\n\nYour email has been sent and is now in your Gmail sent folder.` }], }; } else { return { content: [{ type: "text", text: `❌ Failed to send email: ${result.error || 'Unknown error'}` }], }; } } catch (error) { console.error('Error sending email:', error); return { content: [{ type: "text", text: `Error sending email: ${error instanceof Error ? error.message : String(error)}` }], }; } });
- src/tools.ts:80-82 (schema)Zod schema defining the input parameters for the 'send-email' tool: 'to' (recipient email), 'subject', and 'body'.to: z.string().describe("The email address of the recipient"), subject: z.string().describe("The subject of the email"), body: z.string().describe("The body of the email"),
- src/tools.ts:79-117 (registration)Registration of the 'send-email' tool using McpServer.tool(), including name, description, input schema, and handler function.server.tool("send-email", "Send an email", { to: z.string().describe("The email address of the recipient"), subject: z.string().describe("The subject of the email"), body: z.string().describe("The body of the email"), }, async (args, extra) => { try { const userAddress = "default-user"; const result = await toolset.executeAction({ action: "GMAIL_SEND_EMAIL", entityId: userAddress, params: args }); if (result.successful) { return { content: [{ type: "text", text: `✅ Email sent successfully!\n\nTo: ${args.to}\nSubject: ${args.subject}\n\nYour email has been sent and is now in your Gmail sent folder.` }], }; } else { return { content: [{ type: "text", text: `❌ Failed to send email: ${result.error || 'Unknown error'}` }], }; } } catch (error) { console.error('Error sending email:', error); return { content: [{ type: "text", text: `Error sending email: ${error instanceof Error ? error.message : String(error)}` }], }; } });