getCalendarEvents
Retrieve events from Apple Calendar using a calendar ID to access and manage scheduled appointments and meetings.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| calendarId | Yes |
Implementation Reference
- src/index.ts:40-62 (handler)The MCP server.tool call registers the 'getCalendarEvents' tool, defines its input schema, and provides the handler function that executes the tool logic by calling the calendars helper and formatting the response.server.tool( "getCalendarEvents", { calendarId: z.string() }, async ({ calendarId }) => { try { const events = await calendars.getCalendarEvents(calendarId); return { content: [{ type: "text", text: JSON.stringify({ events }) }] }; } catch (error) { return { content: [{ type: "text", text: JSON.stringify({ error: `Failed to get events from calendar: ${calendarId}` }) }], isError: true }; } } );
- src/index.ts:42-42 (schema)Zod input schema for the getCalendarEvents tool, requiring a 'calendarId' string parameter.{ calendarId: z.string() },
- src/calendars.ts:85-93 (helper)Supporting helper function that makes the HTTP GET request to the Calendar API Bridge to retrieve events for the specified calendar ID.export async function getCalendarEvents(calendarId: string): Promise<any[]> { try { const response = await axios.get(`${API_BASE_URL}/calendars/${calendarId}/events`); return response.data; } catch (error) { console.error(`Failed to get events from calendar "${calendarId}":`, error); throw new Error(`Failed to get calendar events: ${error}`); } }