Skip to main content
Glama
MadLlama25

Fastmail MCP Server

by MadLlama25

list_calendars

Retrieve all available calendars from your Fastmail account to view and manage your scheduled events.

Instructions

List all calendars

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:289-296 (registration)
    Tool registration including name, description, and input schema (empty object since no parameters required) in the MCP tools list.
    {
      name: 'list_calendars',
      description: 'List all calendars',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • MCP server switch-case handler that initializes the contacts/calendar client and delegates to getCalendars() method, returning JSON response.
    case 'list_calendars': {
      const contactsClient = initializeContactsCalendarClient();
      const calendars = await contactsClient.getCalendars();
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(calendars, null, 2),
          },
        ],
      };
    }
  • Core implementation of list_calendars: checks JMAP calendars capability/permission, constructs and sends Calendar/get JMAP request, returns list of calendars.
    async getCalendars(): Promise<any[]> {
      // Check permissions first
      const hasPermission = await this.checkCalendarsPermission();
      if (!hasPermission) {
        throw new Error('Calendar access not available. This account may not have JMAP calendar permissions enabled. Please check your Fastmail account settings or contact support to enable calendar API access.');
      }
    
      const session = await this.getSession();
      
      const request: JmapRequest = {
        using: ['urn:ietf:params:jmap:core', 'urn:ietf:params:jmap:calendars'],
        methodCalls: [
          ['Calendar/get', {
            accountId: session.accountId
          }, 'calendars']
        ]
      };
    
      try {
        const response = await this.makeRequest(request);
        return response.methodResponses[0][1].list;
      } catch (error) {
        // Calendar access might require special permissions
        throw new Error(`Calendar access not supported or requires additional permissions. This may be due to account settings or JMAP scope limitations: ${error instanceof Error ? error.message : String(error)}. Try checking account permissions or enabling calendar API access in Fastmail settings.`);
      }
    }
  • Helper method used by getCalendars() to verify if the JMAP calendars capability is enabled for the account.
    private async checkCalendarsPermission(): Promise<boolean> {
      const session = await this.getSession();
      return !!session.capabilities['urn:ietf:params:jmap:calendars'];
    }

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