Skip to main content
Glama
MadLlama25

Fastmail MCP Server

by MadLlama25

list_calendar_events

Retrieve events from Fastmail calendars with optional calendar ID, date range (ISO 8601), and limit filters. Default returns up to 50 events.

Instructions

List events from a calendar

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
calendarIdNoID of the calendar (optional, defaults to all calendars)
startDateNoFilter events starting from this date (ISO 8601, e.g. 2026-03-23T00:00:00Z)
endDateNoFilter events ending before this date (ISO 8601, e.g. 2026-03-30T00:00:00Z)
limitNoMaximum number of events to return (default: 50)

Implementation Reference

  • src/index.ts:491-516 (registration)
    Tool registration + schema definition for 'list_calendar_events' in the ListTools handler. Defines name, description, and inputSchema with calendarId, startDate, endDate, limit.
    {
      name: 'list_calendar_events',
      description: 'List events from a calendar',
      inputSchema: {
        type: 'object',
        properties: {
          calendarId: {
            type: 'string',
            description: 'ID of the calendar (optional, defaults to all calendars)',
          },
          startDate: {
            type: 'string',
            description: 'Filter events starting from this date (ISO 8601, e.g. 2026-03-23T00:00:00Z)',
          },
          endDate: {
            type: 'string',
            description: 'Filter events ending before this date (ISO 8601, e.g. 2026-03-30T00:00:00Z)',
          },
          limit: {
            type: 'number',
            description: 'Maximum number of events to return (default: 50)',
            default: 50,
          },
        },
      },
    },
  • Handler for 'list_calendar_events' in the CallTool switch. Extracts args (calendarId, limit, startDate, endDate), tries JMAP ContactsCalendarClient first, falls back to CalDAVCalendarClient.
    case 'list_calendar_events': {
      const { calendarId, limit = 50, startDate, endDate } = args as any;
      try {
        const contactsClient = initializeContactsCalendarClient();
        const events = await contactsClient.getCalendarEvents(calendarId, limit);
        return { content: [{ type: 'text', text: JSON.stringify(events, null, 2) }] };
      } catch {
        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 events = await davClient.getCalendarEvents(calendarId, limit, startDate, endDate);
        return { content: [{ type: 'text', text: JSON.stringify(events, null, 2) }] };
      }
    }
  • JMAP implementation: ContactsCalendarClient.getCalendarEvents() - calls CalendarEvent/query then CalendarEvent/get.
    async getCalendarEvents(calendarId?: string, limit: number = 50): 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 filter = calendarId ? { inCalendar: calendarId } : {};
      
      const request: JmapRequest = {
        using: ['urn:ietf:params:jmap:core', 'urn:ietf:params:jmap:calendars'],
        methodCalls: [
          ['CalendarEvent/query', {
            accountId: session.accountId,
            filter,
            sort: [{ property: 'start', isAscending: true }],
            limit
          }, 'query'],
          ['CalendarEvent/get', {
            accountId: session.accountId,
            '#ids': { resultOf: 'query', name: 'CalendarEvent/query', path: '/ids' },
            properties: ['id', 'title', 'description', 'start', 'end', 'location', 'participants']
          }, 'events']
        ]
      };
    
      try {
        const response = await this.makeRequest(request);
        return this.getListResult(response, 1);
      } catch (error) {
        throw new Error(`Calendar events access not supported: ${error instanceof Error ? error.message : String(error)}. Try checking account permissions or enabling calendar API access in Fastmail settings.`);
      }
    }
  • CalDAV fallback implementation: CalDAVCalendarClient.getCalendarEvents() - fetches calendar objects via DAVClient, parses iCalendar VEVENT data.
    async getCalendarEvents(calendarId?: string, limit: number = 50, startDate?: string, endDate?: string): Promise<CalendarEvent[]> {
      const client = await this.getClient();
    
      if (!this.calendars) {
        this.calendars = await client.fetchCalendars();
      }
    
      let targetCalendars = this.calendars.filter(
        c => c.displayName !== 'DEFAULT_TASK_CALENDAR_NAME'
      );
      if (calendarId) {
        targetCalendars = targetCalendars.filter(
          c => c.url === calendarId || c.displayName === calendarId
        );
      }
    
      const fetchOptions: any = {};
      if (startDate || endDate) {
        fetchOptions.timeRange = {
          start: startDate || '1970-01-01T00:00:00Z',
          end: endDate || '2099-12-31T23:59:59Z',
        };
      }
    
      const allEvents: CalendarEvent[] = [];
      for (const cal of targetCalendars) {
        const objects = await client.fetchCalendarObjects({ calendar: cal, ...fetchOptions });
        for (const obj of objects) {
          allEvents.push(parseCalendarObject(obj));
        }
        if (allEvents.length >= limit) break;
      }
    
      // Sort by start date ascending
      allEvents.sort((a, b) => (a.start || '').localeCompare(b.start || ''));
    
      return allEvents.slice(0, limit);
    }
Behavior2/5

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

No annotations provided, so description must cover behavioral traits. It does not mention ordering, pagination, timezone handling, or what happens if no events exist. Only default limit is inferable from schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence without waste. However, it could include more context without losing conciseness.

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?

Given 4 parameters and no output schema or annotations, the description is too sparse. It does not clarify return format, default sorting, or event scope (future/past), leaving gaps for the agent.

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 description coverage is 100%, so baseline is 3. The description adds no extra meaning beyond the schema's parameter descriptions, which are clear.

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 'List events from a calendar' clearly specifies the action (list) and resource (calendar events). It distinguishes from sibling tools like get_calendar_event (single event) and list_calendars (calendar list).

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 when-to-use or when-not-to-use guidance is provided. The description implies use for listing events, but lacks comparison to alternatives like get_calendar_event or guidance on parameter prerequisites.

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