Skip to main content
Glama
owen-nash

Fastmail MCP Server

by owen-nash

bulk_delete

Delete multiple emails by moving them to trash. Provide an array of email IDs to remove them from your inbox.

Instructions

Delete multiple emails (move to trash)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailIdsYesArray of email IDs to delete

Implementation Reference

  • src/index.ts:906-920 (registration)
    Tool 'bulk_delete' is registered with input schema requiring 'emailIds' array. It is listed in the ListToolsRequestSchema handler along with all other tools.
    {
      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'],
      },
    },
  • Handler for the 'bulk_delete' tool: validates emailIds array, delegates to client.bulkDelete(), returns success message.
    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)`,
          },
        ],
      };
    }
  • JmapClient.bulkDelete() implementation: fetches trash mailbox, builds Email/set update for all email IDs to move them to trash, makes JMAP API 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.');
      }
    }
Behavior3/5

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

Specifies the behavior 'move to trash', which is a key detail, but lacks disclosure of additional traits such as irreversibility, permission requirements, rate limits, or effect on trash retention. No annotations are provided, so the description bears full responsibility but only partially fulfills it.

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?

One short sentence that front-loads the core action and outcome. Efficient but could include more detail without losing conciseness.

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?

Adequate for a simple bulk operation with one parameter, but lacks information on partial success, error handling, or limits (e.g., maximum number of IDs). No output schema, so no return value explanation needed. Could be more complete for a bulk action.

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 coverage is 100%, so the schema fully describes the parameter. The description adds no new meaning beyond repeating 'multiple emails'. No extra context on array size limits, required format, or validation rules.

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?

Clearly states the action 'Delete multiple emails' and specifies it moves to trash, distinguishing it from permanent deletion. The tool name 'bulk_delete' is accurately reflected and differentiated from sibling 'delete_email' for single emails.

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

Usage Guidelines3/5

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

Implies use for deleting multiple emails, but no explicit guidance on when to use this tool over alternatives like 'delete_email' for single deletes or 'bulk_move' for moving to other folders. No prerequisites or constraints mentioned.

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