Skip to main content
Glama
MadLlama25

Fastmail MCP Server

by MadLlama25

pin_email

Pin or unpin an email to highlight important messages and keep them easily accessible in your inbox.

Instructions

Pin or unpin an email

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailIdYesID of the email to pin/unpin
pinnedNotrue to pin, false to unpin

Implementation Reference

  • The `pinEmail` method on JmapClient that executes the actual pin/unpin logic. It sends an Email/set JMAP request setting or removing the '$flagged' keyword on the email.
    async pinEmail(emailId: string, pinned: boolean = true): Promise<void> {
      const session = await this.getSession();
    
      const update: Record<string, any> = {};
      update[emailId] = 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
          }, 'pinEmail']
        ]
      };
    
      const response = await this.makeRequest(request);
      const result = this.getMethodResult(response, 0);
    
      if (result.notUpdated && result.notUpdated[emailId]) {
        throw new Error(`Failed to ${pinned ? 'pin' : 'unpin'} email.`);
      }
    }
  • The input schema registration for the 'pin_email' tool in the ListTools handler, defining emailId (required string) and pinned (optional boolean, default true).
    {
      name: 'pin_email',
      description: 'Pin or unpin an email',
      inputSchema: {
        type: 'object',
        properties: {
          emailId: {
            type: 'string',
            description: 'ID of the email to pin/unpin',
          },
          pinned: {
            type: 'boolean',
            description: 'true to pin, false to unpin',
            default: true,
          },
        },
        required: ['emailId'],
      },
    },
  • src/index.ts:1421-1436 (registration)
    The handler registration for 'pin_email' in the CallToolRequestSchema switch statement. Extracts emailId and pinned from args, calls client.pinEmail(), and returns success message.
    case 'pin_email': {
      const { emailId, pinned = true } = args as any;
      if (!emailId) {
        throw new McpError(ErrorCode.InvalidParams, 'emailId is required');
      }
      const client = initializeClient();
      await client.pinEmail(emailId, pinned);
      return {
        content: [
          {
            type: 'text',
            text: `Email ${pinned ? 'pinned' : 'unpinned'} successfully`,
          },
        ],
      };
    }
  • The bulk variant `bulkPinEmails` that pins/unpins multiple emails in a single JMAP Email/set call using the '$flagged' keyword.
    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.');
      }
    }
Behavior2/5

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

No annotations are provided, so the description should disclose behavioral traits. It only states the action without explaining what pinning does (e.g., affect folder visibility, ordering) or side effects like permission requirements.

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 extremely concise at 5 words, with no wasted text. It immediately conveys the tool's purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple toggle operation with clear schema, the description is mostly complete. It lacks indication of return values or success confirmation, but the tool is straightforward.

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% and schema descriptions already explain the parameters. The description adds no extra meaning beyond what the schema provides.

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 'Pin or unpin an email' clearly states the action and resource. It distinguishes from sibling 'bulk_pin' which handles multiple emails, so the single-email scope is implied.

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 on when to use this tool versus alternatives like 'bulk_pin' or when unpinning is preferred. The description does not mention context or preconditions.

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