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
| Name | Required | Description | Default |
|---|---|---|---|
| minAccessRole | No | Minimum access role filter | |
| showDeleted | No | Include deleted calendars (default: false) | |
| showHidden | No | Include 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
- src/index.ts:501-535 (handler)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, }; } }
- src/index.ts:92-96 (schema)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); }