Skip to main content
Glama
owen-nash

Fastmail MCP Server

by owen-nash

bulk_remove_labels

Remove labels from a batch of email messages by providing their IDs and the label mailboxes to detach. Organize your inbox efficiently.

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

  • Schema registration for bulk_remove_labels tool, listing its input parameters (emailIds and mailboxIds, both required arrays of strings).
    {
      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 for the bulk_remove_labels tool: validates inputs, then calls client.bulkRemoveLabels() and returns a success message.
    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`,
          },
        ],
      };
    }
  • src/index.ts:941-960 (registration)
    Registration of the bulk_remove_labels tool in the ListToolsRequestSchema handler.
    {
      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'],
      },
    },
  • Core JMAP implementation of bulkRemoveLabels: builds patch objects setting mailboxIds to null for each email, then sends a single Email/set request with updates for all email IDs at once.
    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?

Without annotations, the description only states the basic operation. It does not disclose behavioral traits such as whether the operation is destructive, reversible, requires permissions, handles partial failures, or has rate limits.

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

Conciseness3/5

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

The description is a single concise sentence. While front-loaded, it is too brief and lacks necessary context, making it merely adequate.

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?

Given no annotations, no output schema, and the presence of sibling tools, the description is incomplete. It does not explain return values, error handling, how it differs from 'remove_labels', or confirm whether labels are removed from all emails atomically.

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% description coverage with clear parameter descriptions. The tool description adds no extra meaning beyond what the schema provides, so baseline 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 action 'Remove labels', the resource 'labels', and the scope 'from multiple emails simultaneously'. It effectively distinguishes from sibling tools like 'remove_labels' (singular) and 'add_labels' (opposite).

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 'remove_labels' or 'bulk_remove_'. There is no mention of prerequisites, conditions, or exclusions.

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