move-to-trash
Delete unwanted emails by moving them to trash using email IDs. This tool helps manage email clutter by removing selected messages from your inbox.
Instructions
Move emails to trash
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| emailIds | Yes | Array of email IDs to move to trash |
Implementation Reference
- src/tools.ts:612-646 (handler)The async handler function that executes the move-to-trash tool logic by delegating to toolset.executeAction with 'GMAIL_MOVE_TO_TRASH' action.}, async (args, extra) => { try { const userAddress = "default-user"; const result = await toolset.executeAction({ action: "GMAIL_MOVE_TO_TRASH", entityId: userAddress, params: args }); if (result.successful) { return { content: [{ type: "text", text: `🗑️ Emails moved to trash successfully!\n\nMoved ${args.emailIds.length} email(s) to trash.` }], }; } else { return { content: [{ type: "text", text: `❌ Failed to move emails to trash: ${result.error || 'Unknown error'}` }], }; } } catch (error) { console.error('Error moving emails to trash:', error); return { content: [{ type: "text", text: `Error moving emails to trash: ${error instanceof Error ? error.message : String(error)}` }], }; } });
- src/tools.ts:611-611 (schema)Zod input schema for the tool parameters: array of email ID strings.emailIds: z.array(z.string()).describe("Array of email IDs to move to trash"),
- src/tools.ts:610-612 (registration)Registration of the 'move-to-trash' tool with server.tool, specifying name, description, schema, and handler reference.server.tool("move-to-trash", "Move emails to trash", { emailIds: z.array(z.string()).describe("Array of email IDs to move to trash"), }, async (args, extra) => {