Skip to main content
Glama
MadLlama25

Fastmail MCP Server

by MadLlama25

bulk_delete

Delete multiple emails at once by providing an array of email IDs to move them to trash.

Instructions

Delete multiple emails (move to trash)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailIdsYesArray of email IDs to delete

Implementation Reference

  • src/index.ts:903-917 (registration)
    Tool 'bulk_delete' registered in the ListToolsRequestSchema handler with name, description, and inputSchema defining required 'emailIds' array parameter.
    {
      name: 'bulk_delete',
      description: 'Delete multiple emails (move to trash)',
      inputSchema: {
        type: 'object',
        properties: {
          emailIds: {
            type: 'array',
            items: { type: 'string' },
            description: 'Array of email IDs to delete',
          },
        },
        required: ['emailIds'],
      },
    },
  • MCP CallToolRequestHandler case for 'bulk_delete' that validates emailIds array and delegates to client.bulkDelete().
    case 'bulk_delete': {
      const { emailIds } = args as any;
      if (!emailIds || !Array.isArray(emailIds) || emailIds.length === 0) {
        throw new McpError(ErrorCode.InvalidParams, 'emailIds array is required and must not be empty');
      }
      const client = initializeClient();
      await client.bulkDelete(emailIds);
      return {
        content: [
          {
            type: 'text',
            text: `${emailIds.length} emails deleted successfully (moved to trash)`,
          },
        ],
      };
    }
  • The actual bulkDelete method in JmapClient: moves multiple emails to the Trash mailbox in a single JMAP Email/set update call.
    async bulkDelete(emailIds: 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 updates: Record<string, any> = {};
      emailIds.forEach(id => {
        updates[id] = { mailboxIds: trashMailboxIds };
      });
    
      const request: JmapRequest = {
        using: ['urn:ietf:params:jmap:core', 'urn:ietf:params:jmap:mail'],
        methodCalls: [
          ['Email/set', {
            accountId: session.accountId,
            update: updates
          }, 'bulkDelete']
        ]
      };
    
      const response = await this.makeRequest(request);
      const result = this.getMethodResult(response, 0);
    
      if (result.notUpdated && Object.keys(result.notUpdated).length > 0) {
        throw new Error('Failed to delete some emails.');
      }
    }
Behavior2/5

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

Lacking annotations, the description only says 'move to trash' without clarifying permanence, reversibility, or side effects. It does not address limits on batch size or what happens if some IDs are invalid.

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

Conciseness4/5

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

The description is a single concise sentence with no wasted words. It is front-loaded and efficient, though lacks additional structure or examples.

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 simple tool with one parameter and no output schema, the description covers the basic purpose. However, it omits usage context like error handling or typical use cases, making it minimally adequate.

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 description adds no extra meaning beyond the schema. The baseline of 3 is appropriate as the description does not enrich parameter understanding.

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 action ('Delete multiple emails') and specifies the result ('move to trash'), using a specific verb and resource. It distinguishes from sibling tools like 'delete_email' (single) and 'bulk_move' (different destination).

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 such as 'delete_email' for single deletions or 'bulk_move' for moving to a different folder. The description does not mention prerequisites or 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