create-draft
Generate email drafts by specifying recipient, subject, and body content to compose messages for communication purposes.
Instructions
Create an email draft
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:287-321 (handler)The async handler function that creates an email draft by executing the Composio 'GMAIL_DRAFT_EMAIL' action and returns success or error messages.}, 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)Zod input schema defining parameters for the create-draft tool: 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:283-283 (registration)The server.tool call that registers the 'create-draft' tool with its description, schema, and handler.server.tool("create-draft", "Create an email draft", {