send-email
Send emails directly from the Meme MCP Server to recipients with specified subjects and body content.
Instructions
Send an email
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | The email address of the recipient | |
| subject | Yes | The subject of the email | |
| body | Yes | The body of the email |
Implementation Reference
- src/tools.ts:79-117 (registration)Registers the 'send-email' tool on the MCP server, including schema and inline 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)}` }], }; } });
- src/tools.ts:80-82 (schema)Zod schema defining the input parameters: to, subject, body for the send-email tool.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:83-117 (handler)The handler function that sends the email using the Composio toolset by executing the GMAIL_SEND_EMAIL action and 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)}` }], }; } });