delete_email
Permanently remove unwanted emails from your Gmail inbox using their message ID to maintain inbox organization and reduce clutter.
Instructions
Permanently delete an email
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| messageId | Yes | Email message ID to delete |
Implementation Reference
- src/tools.ts:80-83 (handler)MCP tool handler case for 'delete_email': validates input parameters and delegates to GmailService.deleteEmail, then returns success message.case "delete_email": { const v = validated as z.infer<typeof schemas.delete_email>; await gmailService.deleteEmail(v.messageId); return { content: [{ type: "text", text: `Email ${v.messageId} deleted successfully.` }] };
- src/tools.ts:11-11 (schema)Zod schema defining the input for the delete_email tool: requires a messageId string.delete_email: z.object({ messageId: z.string().describe("Email message ID to delete") }),
- src/gmail-service.ts:72-74 (handler)Core handler function in GmailService that executes the actual Gmail API deletion for the given email message ID.async deleteEmail(id: string): Promise<void> { await this.gmail.users.messages.delete({ userId: 'me', id }); }
- src/lib.ts:48-48 (registration)MCP server registration for ListTools request, which returns tool definitions including 'delete_email' via getToolDefinitions().server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: getToolDefinitions() }));
- src/tools.ts:50-55 (registration)Function that dynamically generates JSON schemas and descriptions for all tools, including delete_email, for MCP tool listing.export const getToolDefinitions = () => Object.entries(schemas).map(([name, schema]) => ({ name, description: toolDescriptions[name], inputSchema: zodToJsonSchema(schema) }));