create-draft
Generate and save an email draft by specifying the recipient, subject, and body content. Ideal for preparing structured communications within the Meme MCP Server environment.
Instructions
Create an email draft
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:287-321 (handler)The handler function that implements the create-draft tool logic by executing the GMAIL_DRAFT_EMAIL action using the VercelAIToolSet (Composio).}, async (args, extra) => { try { const userAddress = "default-user"; const result = await toolset.executeAction({ action: "GMAIL_DRAFT_EMAIL", entityId: userAddress, params: args }); if (result.successful) { return { content: [{ type: "text", text: `📝 Draft created successfully!\n\nDraft ID: ${(result.data?.response_data as any)?.id}\nTo: ${args.to}\nSubject: ${args.subject}` }], }; } else { return { content: [{ type: "text", text: `❌ Failed to create draft: ${result.error || 'Unknown error'}` }], }; } } catch (error) { console.error('Error creating draft:', error); return { content: [{ type: "text", text: `Error creating draft: ${error instanceof Error ? error.message : String(error)}` }], }; } });
- src/tools.ts:284-286 (schema)Input schema for the create-draft tool using Zod validation for to, subject, and body parameters.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:283-321 (registration)Registration of the create-draft tool via server.tool, including schema and inline handler.server.tool("create-draft", "Create an email draft", { 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_DRAFT_EMAIL", entityId: userAddress, params: args }); if (result.successful) { return { content: [{ type: "text", text: `📝 Draft created successfully!\n\nDraft ID: ${(result.data?.response_data as any)?.id}\nTo: ${args.to}\nSubject: ${args.subject}` }], }; } else { return { content: [{ type: "text", text: `❌ Failed to create draft: ${result.error || 'Unknown error'}` }], }; } } catch (error) { console.error('Error creating draft:', error); return { content: [{ type: "text", text: `Error creating draft: ${error instanceof Error ? error.message : String(error)}` }], }; } });