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,
        }));
    }
Behavior2/5

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

No annotations provided, so description must disclose behavior. It only says 'List all calendars' without mentioning scope, ordering, pagination, or any side effects. Minimal behavioral insight.

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 extraneous text. Perfectly concise for a simple list operation.

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?

Given the simplicity (no parameters, no output schema), the description is mostly adequate. However, it lacks mention of default ordering or limit, which could be useful for completeness.

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 tool has zero parameters, and the description adds no parameter detail. Since schema coverage is 100% (empty), no additional semantics are needed; baseline 4 applies.

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 'List all calendars' clearly states the action and resource. It distinguishes from sibling tools like list_calendar_events, but does not explicitly differentiate from other list operations.

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 (e.g., list_calendar_events). No context about prerequisites or exclusions.

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