Skip to main content
Glama
MadLlama25

Fastmail MCP Server

by MadLlama25

bulk_remove_labels

Remove labels from multiple emails at once. Specify email IDs and mailbox IDs to bulk-remove labels, streamlining email organization.

Instructions

Remove labels from multiple emails simultaneously

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailIdsYesArray of email IDs to remove labels from
mailboxIdsYesArray of mailbox IDs to remove as labels

Implementation Reference

  • src/index.ts:938-957 (registration)
    Tool registration with input schema definition (name 'bulk_remove_labels', requires 'emailIds' and 'mailboxIds' arrays)
    {
      name: 'bulk_remove_labels',
      description: 'Remove labels from multiple emails simultaneously',
      inputSchema: {
        type: 'object',
        properties: {
          emailIds: {
            type: 'array',
            items: { type: 'string' },
            description: 'Array of email IDs to remove labels from',
          },
          mailboxIds: {
            type: 'array',
            items: { type: 'string' },
            description: 'Array of mailbox IDs to remove as labels',
          },
        },
        required: ['emailIds', 'mailboxIds'],
      },
    },
  • Handler case for 'bulk_remove_labels' - extracts emailIds and mailboxIds from args, validates them, then calls client.bulkRemoveLabels()
    case 'bulk_remove_labels': {
      const { emailIds, mailboxIds } = 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');
      }
      if (!mailboxIds || !Array.isArray(mailboxIds) || mailboxIds.length === 0) {
        throw new McpError(ErrorCode.InvalidParams, 'mailboxIds array is required and must not be empty');
      }
      const client = initializeClient();
      await client.bulkRemoveLabels(emailIds, mailboxIds);
      return {
        content: [
          {
            type: 'text',
            text: `Labels removed successfully from ${emailIds.length} emails`,
          },
        ],
      };
    }
  • JMAP client implementation of bulkRemoveLabels - builds a patch to null out mailboxIds for each email, sends Email/set request
    async bulkRemoveLabels(emailIds: string[], mailboxIds: string[]): Promise<void> {
      const session = await this.getSession();
    
      // Build patch object to remove specific mailboxIds
      const patch: Record<string, any> = {};
      mailboxIds.forEach(mailboxId => {
        patch[`mailboxIds/${mailboxId}`] = null;
      });
    
      const updates: Record<string, any> = {};
      emailIds.forEach(id => {
        updates[id] = patch;
      });
    
      const request: JmapRequest = {
        using: ['urn:ietf:params:jmap:core', 'urn:ietf:params:jmap:mail'],
        methodCalls: [
          ['Email/set', {
            accountId: session.accountId,
            update: updates
          }, 'bulkRemoveLabels']
        ]
      };
    
      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 remove labels from some emails.');
      }
    }
Behavior2/5

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

No annotations exist, so the description bears full responsibility for behavioral disclosure. It only states 'simultaneously' without clarifying atomicity, partial failure handling, side effects, or authorization requirements. A score of 2 reflects minimal transparency.

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, front-loaded sentence that conveys the core action without superfluous words. It is optimally concise.

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 bulk mutation tool with no output schema, the description lacks essential context: return value (success/failure counts), error conditions, and behavioral guarantees. This is insufficient for an agent to invoke reliably.

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 already provides 100% coverage for both parameters (emailIds, mailboxIds). The description adds no additional meaning beyond the schema, meriting a baseline score of 3.

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 uses the specific verb 'Remove' and resource 'labels from multiple emails', clearly distinguishing it from siblings like 'remove_labels' (single email) and 'bulk_add_labels' (adding labels). The 'simultaneously' adverb further clarifies bulk operation.

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?

The description provides no guidance on when to use this tool over alternatives such as 'remove_labels' for single emails or 'bulk_add_labels' for adding. No prerequisites or contextual hints are given.

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