Skip to main content
Glama
owen-nash

Fastmail MCP Server

by owen-nash

bulk_add_labels

Add labels to multiple emails in bulk by providing an array of email IDs and an array of mailbox IDs to apply as labels.

Instructions

Add labels to multiple emails simultaneously

Input Schema

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

Implementation Reference

  • src/index.ts:921-940 (registration)
    Registration of the 'bulk_add_labels' tool in the ListTools handler with input schema definition
    {
      name: 'bulk_add_labels',
      description: 'Add labels to multiple emails simultaneously',
      inputSchema: {
        type: 'object',
        properties: {
          emailIds: {
            type: 'array',
            items: { type: 'string' },
            description: 'Array of email IDs to add labels to',
          },
          mailboxIds: {
            type: 'array',
            items: { type: 'string' },
            description: 'Array of mailbox IDs to add as labels',
          },
        },
        required: ['emailIds', 'mailboxIds'],
      },
    },
  • CallToolRequestSchema handler case for 'bulk_add_labels' that validates inputs and delegates to JmapClient.bulkAddLabels
    case 'bulk_add_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.bulkAddLabels(emailIds, mailboxIds);
      return {
        content: [
          {
            type: 'text',
            text: `Labels added successfully to ${emailIds.length} emails`,
          },
        ],
      };
    }
  • Actual JMAP implementation of bulkAddLabels that builds mailboxId patches and sends an Email/set request with updates for multiple email IDs
    async bulkAddLabels(emailIds: string[], mailboxIds: string[]): Promise<void> {
      const session = await this.getSession();
    
      // Build patch object to add specific mailboxIds
      const patch: Record<string, any> = {};
      mailboxIds.forEach(mailboxId => {
        patch[`mailboxIds/${mailboxId}`] = true;
      });
    
      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
          }, 'bulkAddLabels']
        ]
      };
    
      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 add labels to some emails.');
      }
    }
Behavior2/5

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

No annotations provided, so description carries full burden. Only states the action; does not disclose whether labels are added incrementally or replace existing ones, permissions required, atomicity, or rate limits. Minimal behavioral context.

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?

Single sentence, no unnecessary words. Information is front-loaded. Every word earns its place.

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 2 parameters and no output schema, the description is minimally adequate. However, it lacks any indication of return value, side effects, or error conditions. Could be more complete.

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% with both parameters described. The description adds no additional meaning beyond the schema; it's generic. Baseline score of 3 applies.

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?

Description clearly states action (Add), resource (labels), and scope (multiple emails simultaneously). Differentiates from sibling tools like add_labels (single) and bulk_remove_labels (opposite action).

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 usage for batch labeling but provides no explicit guidance on when to use vs alternatives (e.g., add_labels for single email) or when not to use (e.g., need to replace all labels). No prerequisites 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