Skip to main content
Glama
owen-nash

Fastmail MCP Server

by owen-nash

list_calendars

Retrieve a list of all calendars available in your Fastmail account.

Instructions

List all calendars

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:487-493 (registration)
    Registration of the 'list_calendars' tool in the ListToolsRequestSchema handler. Defines the tool name, description, and input schema (no input parameters).
      name: 'list_calendars',
      description: 'List all calendars',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • Handler for the 'list_calendars' tool call. First tries JMAP via ContactsCalendarClient.getCalendars(), and on failure falls back to CalDAV via CalDAVCalendarClient.getCalendars().
    case 'list_calendars': {
      try {
        const contactsClient = initializeContactsCalendarClient();
        const calendars = await contactsClient.getCalendars();
        return { content: [{ type: 'text', text: JSON.stringify(calendars, null, 2) }] };
      } catch {
        // JMAP calendars not available, try CalDAV
        const davClient = initializeCalDAVClient();
        if (!davClient) {
          throw new McpError(ErrorCode.InvalidRequest, 'JMAP calendars not available and CalDAV not configured. Set FASTMAIL_CALDAV_USERNAME and FASTMAIL_CALDAV_PASSWORD to use CalDAV.');
        }
        const calendars = await davClient.getCalendars();
        return { content: [{ type: 'text', text: JSON.stringify(calendars, null, 2) }] };
      }
    }
  • ContactsCalendarClient.getCalendars() - JMAP implementation. Checks calendar permissions, then makes a Calendar/get JMAP API request to the Fastmail server.
    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 this.getListResult(response, 0);
      } 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.`);
      }
    }
  • CalDAVCalendarClient.getCalendars() - CalDAV fallback implementation. Uses tsdav library to fetch calendars and maps them to CalendarInfo objects.
    async getCalendars(): Promise<CalendarInfo[]> {
      const client = await this.getClient();
      const calendars = await client.fetchCalendars();
      this.calendars = calendars;
    
      return calendars
        .filter(c => c.displayName !== 'DEFAULT_TASK_CALENDAR_NAME')
        .map(c => ({
          id: c.url || '',
          displayName: String(c.displayName || 'Unnamed'),
          url: c.url || '',
          description: c.description || undefined,
          color: (c as any).calendarColor || undefined,
        }));
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.9.4

TDQS

B3.1/5.0
Behavior2/5

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

The description does not disclose behavioral traits beyond the obvious read-only nature. Since no annotations exist, the description carries full burden, but it fails to mention safety (e.g., no side effects), rate limits, or required permissions.

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 extraneous words, fully front-loading the tool's purpose.

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?

For a zero-parameter tool with no output schema, the description lacks completeness about return format (e.g., IDs, names) and context (e.g., linked to which account). The agent may be unable to process the response effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has zero parameters, and the description adds the purpose 'List all calendars,' which provides meaning beyond the empty schema. With 100% schema coverage, the baseline is 4, and the description justifiably earns that score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('List') and resource ('calendars'), distinguishing it from sibling tools like list_events or list_emails. However, it does not specify what type of calendars (e.g., Google Calendar) or any scoping, leaving slight ambiguity.

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 get_freebusy or list_events. There are no explicit when-not or precondition mentions, relying on the agent to infer from the name.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.