Skip to main content
Glama

Google Calendar MCP Server

by peadams21

list_calendars

Retrieve available Google Calendars with filters for access roles, deleted, and hidden calendars using the Google Calendar MCP Server integration.

Instructions

List available Google Calendars

Input Schema

NameRequiredDescriptionDefault
minAccessRoleNoMinimum access role filter
showDeletedNoInclude deleted calendars (default: false)
showHiddenNoInclude hidden calendars (default: false)

Input Schema (JSON Schema)

{ "properties": { "minAccessRole": { "description": "Minimum access role filter", "enum": [ "freeBusyReader", "owner", "reader", "writer" ], "type": "string" }, "showDeleted": { "default": false, "description": "Include deleted calendars (default: false)", "type": "boolean" }, "showHidden": { "default": false, "description": "Include hidden calendars (default: false)", "type": "boolean" } }, "type": "object" }

Implementation Reference

  • The main handler function that implements the logic for the 'list_calendars' tool. It calls the Google Calendar API's calendarList.list method with the provided arguments and returns the list of calendars or an error.
    async function handleListCalendars(args: z.infer<typeof ListCalendarsArgsSchema>) { try { const response = await calendar.calendarList.list({ minAccessRole: args.minAccessRole, showDeleted: args.showDeleted, showHidden: args.showHidden, }); return { content: [ { type: "text", text: JSON.stringify({ success: true, calendars: response.data.items || [], summary: `Found ${(response.data.items || []).length} calendars`, }, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: JSON.stringify({ success: false, error: error instanceof Error ? error.message : "Unknown error", }, null, 2), }, ], isError: true, }; } }
  • Zod schema used for validating the input arguments to the list_calendars tool handler.
    const ListCalendarsArgsSchema = z.object({ minAccessRole: z.enum(["freeBusyReader", "owner", "reader", "writer"]).optional(), showDeleted: z.boolean().optional().default(false), showHidden: z.boolean().optional().default(false), });
  • src/index.ts:311-334 (registration)
    The registration of the 'list_calendars' tool in the MCP tools array, including its name, description, and JSON input schema.
    { name: "list_calendars", description: "List available Google Calendars", inputSchema: { type: "object", properties: { minAccessRole: { type: "string", enum: ["freeBusyReader", "owner", "reader", "writer"], description: "Minimum access role filter", }, showDeleted: { type: "boolean", description: "Include deleted calendars (default: false)", default: false, }, showHidden: { type: "boolean", description: "Include hidden calendars (default: false)", default: false, }, }, }, },
  • src/index.ts:563-566 (registration)
    The switch case in the main CallToolRequest handler that routes 'list_calendars' calls to the specific handler after validation.
    case "list_calendars": { const validatedArgs = ListCalendarsArgsSchema.parse(args); return await handleListCalendars(validatedArgs); }

Other Tools

Related 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/peadams21/Google-Calendar-MCP-Server'

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