Skip to main content
Glama

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
NameRequiredDescriptionDefault
messageIdYesEmail message ID to delete

Implementation Reference

  • 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.` }] };
  • 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") }),
  • 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) }));

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/muammar-yacoob/GMail-Manager-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server