Skip to main content
Glama
ricleedo

Google Services MCP Server

by ricleedo

calendar-list-calendars

Retrieve all available calendars from Google Calendar to view and manage your schedule across multiple calendars.

Instructions

List all available calendars

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
maxResultsNoMaximum number of calendars to return

Implementation Reference

  • Main handler function that fetches the list of calendars from Google Calendar API using calendarList.list, maps the data, formats it to markdown using formatCalendarsToMarkdown, and returns structured content.
    export async function listCalendars(
      params: z.infer<ReturnType<typeof listCalendarsSchema>>
    ) {
      try {
        const auth = createCalendarAuth();
        const calendar = google.calendar({ version: "v3", auth });
    
        const response = await calendar.calendarList.list({
          maxResults: params.maxResults,
        });
    
        const calendars = response.data.items?.map((cal) => ({
          id: cal.id,
          summary: cal.summary,
          description: cal.description,
          timeZone: cal.timeZone,
          accessRole: cal.accessRole,
          primary: cal.primary,
          backgroundColor: cal.backgroundColor,
          foregroundColor: cal.foregroundColor,
        }));
    
        return {
          content: [
            {
              type: "text" as const,
              text: formatCalendarsToMarkdown(calendars || []),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text" as const,
              text: `Error listing calendars: ${
                error instanceof Error ? error.message : String(error)
              }`,
            },
          ],
        };
      }
    }
  • Zod schema defining the input parameters for the listCalendars tool, specifically maxResults.
    export const listCalendarsSchema = () =>
      z.object({
        maxResults: z
          .number()
          .min(1)
          .max(250)
          .default(10)
          .describe("Maximum number of calendars to return"),
      });
  • src/index.ts:260-267 (registration)
    Registration of the 'calendar-list-calendars' tool in the MCP server within registerCalendarTools function.
    server.tool(
      "calendar-list-calendars",
      "List all available calendars",
      listCalendarsSchema().shape,
      async (params) => {
        return await listCalendars(params);
      }
    );
  • Helper function used by the handler to format the calendars list into a readable markdown string.
    function formatCalendarsToMarkdown(calendars: any[]): string {
      if (!calendars.length) return "No calendars found.";
      
      let markdown = `# Available Calendars (${calendars.length})\n\n`;
      
      calendars.forEach((cal, index) => {
        markdown += `## ${index + 1}. ${cal.summary || cal.id}\n`;
        markdown += `ID: \`${cal.id}\`  \n`;
        if (cal.description) markdown += `Description: ${cal.description}  \n`;
        if (cal.timeZone) markdown += `Time Zone: ${cal.timeZone}  \n`;
        if (cal.accessRole) markdown += `Access: ${cal.accessRole}  \n`;
        if (cal.primary) markdown += `Primary: Yes ⭐  \n`;
        markdown += `\n`;
      });
      
      return markdown;
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.0.0
    • addedInput schema / $schema
      Added value: +"http://json-schema.org/draft-07/schema#"
    • addedInput schema / additionalProperties
      Added value: +false
  2. First observed

TDQS

B3.1/5.0
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. 'List all available calendars' implies a read-only operation but doesn't specify permissions needed, whether it returns personal/shared calendars, pagination behavior, or format of returned data. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

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, efficient sentence with zero wasted words. It's appropriately sized for a simple list operation and front-loads the core functionality immediately.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (single optional parameter) and 100% schema coverage, the description is minimally adequate. However, with no output schema and no annotations, the description should ideally clarify what 'calendars' means in this context (metadata, IDs, names) and any scope limitations. It meets minimum viability but has clear 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 single parameter 'maxResults'. The description adds no parameter information beyond what's in the schema. According to scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no param info in description.

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 verb ('List') and resource ('all available calendars'), making the purpose immediately understandable. However, it doesn't differentiate this tool from its sibling 'calendar-list-events', which could cause confusion about whether this lists calendar metadata vs. calendar entries.

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?

The description provides no guidance on when to use this tool versus alternatives. With sibling tools like 'calendar-list-events' and 'calendar-create-event', there's no indication whether this is for administrative setup, user selection, or other contexts. The agent must infer usage from the name alone.

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