Skip to main content
Glama
NOVA-3951

Fastmail Calendar MCP Server

list_events

Read-onlyIdempotent

Retrieve calendar events within a specified date range from Fastmail, providing event details like title, time, location, and description for viewing or management.

Instructions

STEP 2 - Get events from a calendar. PREREQUISITE: You must first call list_calendars to get the calendarUrl. Returns events within the specified date range. Each event contains: url (needed for update/delete), etag (needed for delete), and data (iCalendar format with SUMMARY=title, DTSTART=start time, DTEND=end time, LOCATION, DESCRIPTION). Parse the iCalendar data to show event details to the user.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
calendarUrlYesREQUIRED. The calendar URL from list_calendars output. Example: 'https://caldav.fastmail.com/dav/calendars/user/example@fastmail.com/default/'
startDateYesREQUIRED. Start of date range in ISO format. For today: use current date. Example: '2024-12-01' or '2024-12-01T00:00:00Z'
endDateYesREQUIRED. End of date range in ISO format. For a single day, use the next day. Example: '2024-12-02' or '2024-12-31T23:59:59Z'

Implementation Reference

  • The handler function for the 'list_events' tool. It processes input parameters (calendarUrl, startDate, endDate), handles test mode with mock events, validates dates, fetches calendar objects using the DAV client within the specified time range, maps them to {url, etag, data}, and returns as JSON.
    case "list_events": {
      const { calendarUrl, startDate, endDate } = args as {
        calendarUrl: string;
        startDate: string;
        endDate: string;
      };
    
      if (isTestMode) {
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                _testMode: true,
                _message: "Demo mode - showing sample events. Use real Fastmail credentials for actual data.",
                events: MOCK_EVENTS,
              }, null, 2),
            },
          ],
        };
      }
    
      const calendar = calendars.find((cal) => cal.url === calendarUrl);
      if (!calendar) {
        throw new Error(`Calendar not found: ${calendarUrl}`);
      }
    
      const start = new Date(startDate);
      if (isNaN(start.getTime())) {
        throw new Error(`Invalid start date: ${startDate}`);
      }
    
      const end = new Date(endDate);
      if (isNaN(end.getTime())) {
        throw new Error(`Invalid end date: ${endDate}`);
      }
    
      const calendarObjects = await davClient.fetchCalendarObjects({
        calendar,
        timeRange: {
          start: startDate,
          end: endDate,
        },
      });
    
      const events = calendarObjects.map((obj: DAVCalendarObject) => ({
        url: obj.url,
        etag: obj.etag,
        data: obj.data,
      }));
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(events, null, 2),
          },
        ],
      };
    }
  • src/index.ts:261-289 (registration)
    Registration of the 'list_events' tool in the ListToolsRequestSchema response, including name, detailed description, input schema (with properties and required fields), and annotations indicating it's read-only and idempotent.
    {
      name: "list_events",
      description: `STEP 2 - Get events from a calendar. PREREQUISITE: You must first call list_calendars to get the calendarUrl. Returns events within the specified date range. Each event contains: url (needed for update/delete), etag (needed for delete), and data (iCalendar format with SUMMARY=title, DTSTART=start time, DTEND=end time, LOCATION, DESCRIPTION). Parse the iCalendar data to show event details to the user.`,
      inputSchema: {
        type: "object",
        properties: {
          calendarUrl: {
            type: "string",
            description: "REQUIRED. The calendar URL from list_calendars output. Example: 'https://caldav.fastmail.com/dav/calendars/user/example@fastmail.com/default/'",
          },
          startDate: {
            type: "string",
            description: "REQUIRED. Start of date range in ISO format. For today: use current date. Example: '2024-12-01' or '2024-12-01T00:00:00Z'",
          },
          endDate: {
            type: "string",
            description: "REQUIRED. End of date range in ISO format. For a single day, use the next day. Example: '2024-12-02' or '2024-12-31T23:59:59Z'",
          },
        },
        required: ["calendarUrl", "startDate", "endDate"],
      },
      annotations: {
        title: "List Events",
        readOnlyHint: true,
        destructiveHint: false,
        idempotentHint: true,
        openWorldHint: false,
      },
    },
  • Input schema definition for the 'list_events' tool, specifying the object with required properties: calendarUrl, startDate, endDate, each with type string and descriptions.
    inputSchema: {
      type: "object",
      properties: {
        calendarUrl: {
          type: "string",
          description: "REQUIRED. The calendar URL from list_calendars output. Example: 'https://caldav.fastmail.com/dav/calendars/user/example@fastmail.com/default/'",
        },
        startDate: {
          type: "string",
          description: "REQUIRED. Start of date range in ISO format. For today: use current date. Example: '2024-12-01' or '2024-12-01T00:00:00Z'",
        },
        endDate: {
          type: "string",
          description: "REQUIRED. End of date range in ISO format. For a single day, use the next day. Example: '2024-12-02' or '2024-12-31T23:59:59Z'",
        },
      },
      required: ["calendarUrl", "startDate", "endDate"],
    },
  • Mock events data used in test mode by the list_events handler to simulate event listing without real Fastmail credentials.
    const MOCK_EVENTS = [
      {
        url: "https://caldav.fastmail.com/dav/calendars/user/demo@fastmail.com/personal/event1.ics",
        etag: '"demo-etag-1"',
        summary: "Team Standup",
        description: "Daily sync meeting",
        location: "Conference Room A",
        startDate: new Date(Date.now() + 86400000).toISOString(),
        endDate: new Date(Date.now() + 86400000 + 1800000).toISOString(),
      },
      {
        url: "https://caldav.fastmail.com/dav/calendars/user/demo@fastmail.com/personal/event2.ics",
        etag: '"demo-etag-2"',
        summary: "Lunch with Client",
        description: "Discuss Q1 goals",
        location: "Downtown Cafe",
        startDate: new Date(Date.now() + 172800000).toISOString(),
        endDate: new Date(Date.now() + 172800000 + 3600000).toISOString(),
      },
    ];
Behavior4/5

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

Annotations already indicate read-only, non-destructive, and idempotent behavior, but the description adds valuable context about the return format (iCalendar data with specific fields like url, etag, and data) and parsing instructions, which goes beyond what annotations provide without contradicting them.

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?

Front-loaded with the core purpose and prerequisite, followed by return details and parsing instructions. The sentences are efficient, but the description could be slightly more streamlined by integrating some details (e.g., the parsing note might be condensed).

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 lack of an output schema, the description compensates by detailing the return structure (url, etag, data) and iCalendar format, which is essential for understanding the tool's output. However, it doesn't mention potential limitations like pagination or error cases, leaving minor gaps.

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 the schema fully documents the three required parameters. The description adds minimal semantic context beyond the schema, such as linking calendarUrl to list_calendars output, but doesn't provide additional parameter details, meeting the baseline for high schema coverage.

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 clearly states the specific action ('Get events from a calendar') and resource ('events'), distinguishing it from siblings like create_event, delete_event, get_event_details, and update_event by focusing on listing/retrieval rather than modification or detailed single-event operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly states a prerequisite ('You must first call list_calendars to get the calendarUrl') and provides clear context on when to use this tool (for retrieving events within a date range), with implicit alternatives being other event-related tools for different operations.

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/NOVA-3951/Fastmail-Calendar-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server