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

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

With no annotations provided, the description carries full burden for behavioral disclosure. 'List all available calendars' implies a read-only operation but doesn't specify whether this requires authentication, what 'available' means (e.g., accessible vs. all system calendars), or any rate limits. It provides minimal behavioral context beyond the basic operation.

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 purpose immediately. Every word earns its place without redundancy or unnecessary elaboration.

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?

For a simple list tool with one well-documented parameter and no output schema, the description is minimally adequate. However, it doesn't address what 'all available calendars' means in practice (e.g., personal vs. shared, access permissions) or what the return format looks like. Given the lack of annotations and output schema, more context about the listing behavior would be helpful.

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?

The description adds no parameter information beyond what's already in the schema (which has 100% coverage). The schema fully documents the 'maxResults' parameter with type, range, default, and description. The description doesn't compensate or add semantic context, so it meets the baseline for high schema coverage.

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 available calendars' clearly states the verb ('List') and resource ('calendars'), making the tool's purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'calendar-list-events', which might cause confusion about scope. The description is specific but lacks sibling distinction.

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. There's no mention of when to use 'calendar-list-calendars' versus 'calendar-list-events' or other calendar-related tools. The agent receives no contextual direction about appropriate use cases 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/ricleedo/Google-Service-MCP'

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