forward-email
Forward emails to other recipients by specifying the email ID and destination address, with optional additional messages included.
Instructions
Forward an email to other recipients
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| emailId | Yes | The ID of the email to forward | |
| to | Yes | The email address to forward to | |
| message | No | Additional message to include with the forward |
Implementation Reference
- src/tools.ts:246-280 (handler)The main handler function that implements the forward-email tool logic by executing the GMAIL_FORWARD_EMAIL action via the Composio toolset and handling the response.}, async (args, extra) => { try { const userAddress = "default-user"; const result = await toolset.executeAction({ action: "GMAIL_FORWARD_EMAIL", entityId: userAddress, params: args }); if (result.successful) { return { content: [{ type: "text", text: `✅ Email forwarded successfully!\n\nForwarded to: ${args.to}` }], }; } else { return { content: [{ type: "text", text: `❌ Failed to forward email: ${result.error || 'Unknown error'}` }], }; } } catch (error) { console.error('Error forwarding email:', error); return { content: [{ type: "text", text: `Error forwarding email: ${error instanceof Error ? error.message : String(error)}` }], }; } });
- src/tools.ts:243-245 (schema)Zod schema defining the input parameters for the forward-email tool: emailId (required), to (required), message (optional).emailId: z.string().describe("The ID of the email to forward"), to: z.string().describe("The email address to forward to"), message: z.string().optional().describe("Additional message to include with the forward"),
- src/tools.ts:242-280 (registration)Full registration of the forward-email tool using server.tool, including name, description, schema, and inline handler.server.tool("forward-email", "Forward an email to other recipients", { emailId: z.string().describe("The ID of the email to forward"), to: z.string().describe("The email address to forward to"), message: z.string().optional().describe("Additional message to include with the forward"), }, async (args, extra) => { try { const userAddress = "default-user"; const result = await toolset.executeAction({ action: "GMAIL_FORWARD_EMAIL", entityId: userAddress, params: args }); if (result.successful) { return { content: [{ type: "text", text: `✅ Email forwarded successfully!\n\nForwarded to: ${args.to}` }], }; } else { return { content: [{ type: "text", text: `❌ Failed to forward email: ${result.error || 'Unknown error'}` }], }; } } catch (error) { console.error('Error forwarding email:', error); return { content: [{ type: "text", text: `Error forwarding email: ${error instanceof Error ? error.message : String(error)}` }], }; } });