list_calendars
Retrieve available Google Calendars with options to filter by access role and include deleted or hidden calendars.
Instructions
List available Google Calendars
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_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) |
Implementation Reference
- src/index.ts:501-535 (handler)The main handler function that executes the list_calendars tool logic, calling the Google Calendar API to list calendars.
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 for validating input arguments to the list_calendars tool.
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)Tool registration in the tools array, defining name, description, and input schema for list_calendars.
{ 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 (helper)Dispatch case in the main CallToolRequestSchema handler that routes to the list_calendars handler after validation.
case "list_calendars": { const validatedArgs = ListCalendarsArgsSchema.parse(args); return await handleListCalendars(validatedArgs); }