Skip to main content
Glama
owen-nash

Fastmail MCP Server

by owen-nash

delete_email

Move an email to the trash using its ID to remove it from your inbox.

Instructions

Delete an email (move to trash)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailIdYesID of the email to delete

Implementation Reference

  • src/index.ts:648-661 (registration)
    Tool registration: defines the 'delete_email' MCP tool name, description, and input schema (requires emailId).
    {
      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: the switch-case branch that extracts emailId, validates it, calls client.deleteEmail(), and returns 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)',
          },
        ],
      };
    }
  • Helper: JmapClient.deleteEmail() — the actual JMAP API call. Finds the Trash mailbox and uses Email/set to move the email there (by setting its mailboxIds to the trash mailbox).
    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.');
      }
    }
Behavior2/5

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

No annotations are provided, so the description must convey behavioral traits. It adds a nuance that deletion means moving to trash, but does not disclose if it's reversible, requires permissions, or triggers side effects.

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?

A single, concise sentence that efficiently conveys the core action. No unnecessary words.

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

Completeness3/5

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

For a low-complexity tool with no output schema and no annotations, the description is minimally adequate but missing expected return value or success/failure indicator. It does not fully compensate for the lack of structured metadata.

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 schema covers 100% of the parameter 'emailId' with a clear description. The tool description adds no additional meaning beyond the schema, meeting the baseline for high coverage.

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 'Delete an email (move to trash)' clearly states the action and the specific resource (email). It distinguishes from sibling tools like 'bulk_delete' (batch) and 'move_email' (different 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 on when to use this tool versus alternatives (e.g., 'bulk_delete' for multiple emails, 'move_email' for relocating). The description lacks context for selection.

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

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