Skip to main content
Glama
MadLlama25

Fastmail MCP Server

by MadLlama25

delete_email

Move an email to trash by providing its email ID. Use this tool to discard unwanted messages from your Fastmail inbox.

Instructions

Delete an email (move to trash)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailIdYesID of the email to delete

Implementation Reference

  • src/index.ts:645-658 (registration)
    Tool registration/definition in the ListToolsRequestSchema handler. Defines the 'delete_email' tool with name, description, and inputSchema requiring an 'emailId' parameter.
    {
      name: 'delete_email',
      description: 'Delete an email (move to trash)',
      inputSchema: {
        type: 'object',
        properties: {
          emailId: {
            type: 'string',
            description: 'ID of the email to delete',
          },
        },
        required: ['emailId'],
      },
    },
  • Handler in the CallToolRequestSchema switch statement. Extracts emailId from args, validates it's provided, calls client.deleteEmail(emailId), and returns a success message.
    case 'delete_email': {
      const { emailId } = args as any;
      if (!emailId) {
        throw new McpError(ErrorCode.InvalidParams, 'emailId is required');
      }
      const client = initializeClient();
      await client.deleteEmail(emailId);
      return {
        content: [
          {
            type: 'text',
            text: 'Email deleted successfully (moved to trash)',
          },
        ],
      };
    }
  • Actual implementation of the deleteEmail method in JmapClient. Finds the Trash mailbox and uses JMAP Email/set to update the email's mailboxIds to point to trash only, effectively moving it to trash.
    async deleteEmail(emailId: string): Promise<void> {
      const session = await this.getSession();
      
      // Find the trash mailbox
      const mailboxes = await this.getMailboxes();
      const trashMailbox = this.findMailboxByRoleOrName(mailboxes, 'trash', 'trash');
    
      if (!trashMailbox) {
        throw new Error('Could not find Trash mailbox');
      }
    
      const trashMailboxIds: Record<string, boolean> = {};
      trashMailboxIds[trashMailbox.id] = true;
    
      const request: JmapRequest = {
        using: ['urn:ietf:params:jmap:core', 'urn:ietf:params:jmap:mail'],
        methodCalls: [
          ['Email/set', {
            accountId: session.accountId,
            update: {
              [emailId]: {
                mailboxIds: trashMailboxIds
              }
            }
          }, 'moveToTrash']
        ]
      };
    
      const response = await this.makeRequest(request);
      const result = this.getMethodResult(response, 0);
      
      if (result.notUpdated && result.notUpdated[emailId]) {
        throw new Error('Failed to delete email.');
      }
    }
Behavior3/5

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

The description notes 'move to trash', implying the action is reversible, but does not explain if the operation is idempotent, requires special permissions, or any side effects. With no annotations, more detail would help, but the provided information is minimally adequate.

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 a single, concise sentence that conveys the core action and nuance. No unnecessary words or information.

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

Completeness4/5

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

Given the simplicity of the tool (one parameter, no output schema, no nested objects), the description is sufficient. It could mention whether the email is permanently deleted or recoverable, but the 'move to trash' clarification addresses a key concern.

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?

The input schema has 100% coverage with a description for the single parameter 'emailId'. The tool description adds no additional meaning beyond what the schema already provides, so baseline score of 3 is appropriate.

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

Purpose5/5

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

The description clearly states the verb 'delete' and the resource 'email', and explicitly mentions the action 'move to trash', which distinguishes it from other email operations like permanent deletion or moving to a specific folder.

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 like bulk_delete, move_email, or other deletion-related tools among the 19 siblings. The agent is left to infer usage without context.

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

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/MadLlama25/fastmail-mcp'

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