Skip to main content
Glama
owen-nash

Fastmail MCP Server

by owen-nash

bulk_pin

Pin or unpin multiple emails at once to organize your inbox efficiently.

Instructions

Pin or unpin multiple emails

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailIdsYesArray of email IDs to pin/unpin
pinnedNotrue to pin, false to unpin

Implementation Reference

  • The `bulkPinEmails` method in JmapClient that executes the actual JMAP API call to pin/unpin multiple emails. It builds an `Email/set` request with keyword/$flagged updates for each email ID.
    async bulkPinEmails(emailIds: string[], pinned: boolean = true): Promise<void> {
      const session = await this.getSession();
    
      const updates: Record<string, any> = {};
      emailIds.forEach(id => {
        updates[id] = pinned
          ? { 'keywords/$flagged': true }
          : { 'keywords/$flagged': null };
      });
    
      const request: JmapRequest = {
        using: ['urn:ietf:params:jmap:core', 'urn:ietf:params:jmap:mail'],
        methodCalls: [
          ['Email/set', {
            accountId: session.accountId,
            update: updates
          }, 'bulkFlag']
        ]
      };
    
      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 pin/unpin some emails.');
      }
    }
  • The 'bulk_pin' case in the CallToolRequestSchema handler. Extracts emailIds and pinned from args, validates, then calls client.bulkPinEmails().
    case 'bulk_pin': {
      const { emailIds, pinned = true } = 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.bulkPinEmails(emailIds, pinned);
      return {
        content: [
          {
            type: 'text',
            text: `${emailIds.length} emails ${pinned ? 'pinned' : 'unpinned'} successfully`,
          },
        ],
      };
    }
  • The tool registration with inputSchema for 'bulk_pin'. Defines emailIds (array of strings, required) and pinned (boolean, default true).
      name: 'bulk_pin',
      description: 'Pin or unpin multiple emails',
      inputSchema: {
        type: 'object',
        properties: {
          emailIds: {
            type: 'array',
            items: { type: 'string' },
            description: 'Array of email IDs to pin/unpin',
          },
          pinned: {
            type: 'boolean',
            description: 'true to pin, false to unpin',
            default: true,
          },
        },
        required: ['emailIds'],
      },
    },
  • src/index.ts:867-886 (registration)
    Registration of the 'bulk_pin' tool in the ListToolsRequestSchema handler.
    {
      name: 'bulk_pin',
      description: 'Pin or unpin multiple emails',
      inputSchema: {
        type: 'object',
        properties: {
          emailIds: {
            type: 'array',
            items: { type: 'string' },
            description: 'Array of email IDs to pin/unpin',
          },
          pinned: {
            type: 'boolean',
            description: 'true to pin, false to unpin',
            default: true,
          },
        },
        required: ['emailIds'],
      },
    },
Behavior2/5

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

No annotations provided, and the description does not disclose any behavioral traits such as side effects, permissions, or error conditions. Minimal information.

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, concise sentence with no wasted words. Well front-loaded.

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?

Given the simple parameters and lack of annotations or output schema, the description is adequate but does not cover behavioral context like idempotency or error handling.

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; the description adds no extra meaning beyond the schema's parameter descriptions.

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 tool's action ('pin or unpin') and the resource ('multiple emails'), distinguishing it from the singular 'pin_email' sibling.

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?

No explicit guidance on when to use this tool vs. alternatives like 'pin_email'. The bulk vs. single distinction is implied but not stated.

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