Skip to main content
Glama

google_gmail_delete_email

Delete or move Gmail emails to trash using the message ID; choose permanent deletion or temporary removal to declutter your inbox effectively.

Instructions

Delete or trash an email

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageIdYesID of the email to delete
permanentlyNoWhether to permanently delete or move to trash

Implementation Reference

  • The core handler function that executes the tool logic: validates arguments and calls the Gmail service to delete the email.
    export async function handleGmailDeleteEmail(
      args: any,
      googleGmailInstance: GoogleGmail
    ) {
      if (!isDeleteEmailArgs(args)) {
        throw new Error("Invalid arguments for google_gmail_delete_email");
      }
      const { messageId, permanently } = args;
      const result = await googleGmailInstance.deleteEmail(messageId, permanently);
      return {
        content: [{ type: "text", text: result }],
        isError: false,
      };
    }
  • The switch case in the main server request handler that routes the tool call to the specific Gmail delete handler.
    case "google_gmail_delete_email":
      return await gmailHandlers.handleGmailDeleteEmail(
        args,
        googleGmailInstance
      );
  • Tool definition including name, description, and input schema for validation.
    export const DELETE_EMAIL_TOOL: Tool = {
      name: "google_gmail_delete_email",
      description: "Delete or trash an email",
      inputSchema: {
        type: "object",
        properties: {
          messageId: {
            type: "string",
            description: "ID of the email to delete",
          },
          permanently: {
            type: "boolean",
            description: "Whether to permanently delete or move to trash",
          },
        },
        required: ["messageId"],
      },
    };
  • Argument validation type guard function used by the handler.
    export function isDeleteEmailArgs(args: any): args is {
      messageId: string;
      permanently?: boolean;
    } {
      return (
        args &&
        typeof args.messageId === "string" &&
        (args.permanently === undefined || typeof args.permanently === "boolean")
      );
    }
  • tools/index.ts:3-15 (registration)
    Includes Gmail tools (containing delete_email tool) in the central tools export used by the MCP server.
    import { gmailTools } from "./gmail/index";
    import { driveTools } from "./drive/index";
    import { tasksTools } from "./tasks/index";
    
    const tools = [
      // OAuth tools
      ...oauthTools,
    
      // Calendar tools
      ...calendarTools,
    
      // Gmail tools
      ...gmailTools,
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but offers minimal behavioral information. It mentions the 'delete or trash' distinction but doesn't disclose critical behaviors like whether deletion requires specific permissions, if it's reversible from trash, what happens to threads when one email is deleted, or any rate limits. For a destructive operation, this is inadequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise at just 4 words, front-loading the core action. Every word earns its place - 'delete or trash' captures the dual functionality, 'an email' specifies the resource. There's zero redundancy or unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive operation with no annotations and no output schema, the description is insufficient. It doesn't explain what happens after deletion (success confirmation, error cases), doesn't mention authentication requirements, and provides no context about the Gmail-specific behaviors. Given the complexity of email deletion (threads, labels, trash behavior), more completeness is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already fully documents both parameters. The description adds no additional parameter semantics beyond what's in the schema - it doesn't explain where to find messageId, what format it uses, or provide examples of when to use 'permanently=true' versus false. Baseline 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('delete or trash') and resource ('an email'), making the purpose immediately understandable. However, it doesn't differentiate this tool from its sibling 'google_gmail_modify_labels' which might also affect email deletion status, nor does it specify whether this works on drafts vs. sent emails.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. For example, it doesn't mention whether 'google_gmail_modify_labels' could be used for moving to trash via label changes, or clarify if this should be used instead of batch deletion methods. The description offers no context about prerequisites or typical workflows.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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/vakharwalad23/google-mcp'

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