calendar-get-event
Retrieve specific calendar event details using the event ID to access event information from Google Calendar.
Instructions
Get a specific calendar event by ID
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| calendarId | No | Calendar ID - Available options: 'primary' (Primary Calendar) | primary |
| eventId | Yes | Event ID |
Input Schema (JSON Schema)
{
"properties": {
"calendarId": {
"default": "primary",
"description": "Calendar ID - Available options: 'primary' (Primary Calendar)",
"type": "string"
},
"eventId": {
"description": "Event ID",
"type": "string"
}
},
"required": [
"eventId"
],
"type": "object"
}
Implementation Reference
- src/calendar.ts:408-463 (handler)Implementation of the getEvent handler function that retrieves a specific calendar event by ID using the Google Calendar API and formats it as Markdown.// Get specific event function export async function getEvent( params: z.infer<ReturnType<typeof getEventSchema>> ) { try { const auth = createCalendarAuth(); const calendar = google.calendar({ version: "v3", auth }); const response = await calendar.events.get({ calendarId: params.calendarId, eventId: params.eventId, }); const event = response.data; const eventDetail = { id: event.id, summary: event.summary, description: event.description, location: event.location, start: event.start, end: event.end, attendees: event.attendees?.map((a) => ({ email: a.email, displayName: a.displayName, responseStatus: a.responseStatus, })), creator: event.creator, organizer: event.organizer, htmlLink: event.htmlLink, status: event.status, created: event.created, updated: event.updated, recurrence: event.recurrence, }; return { content: [ { type: "text" as const, text: formatEventToMarkdown(eventDetail), }, ], }; } catch (error) { return { content: [ { type: "text" as const, text: `Error getting event: ${ error instanceof Error ? error.message : String(error) }`, }, ], }; } }
- src/calendar.ts:196-203 (schema)Zod schema definition for validating inputs to the calendar-get-event tool: requires eventId, optional calendarId.export const getEventSchema = () => z.object({ eventId: z.string().describe("Event ID"), calendarId: z .string() .default("primary") .describe(getCalendarDescription()), });
- src/index.ts:233-240 (registration)Registration of the "calendar-get-event" tool in the MCP server, linking to getEvent handler and schema.server.tool( "calendar-get-event", "Get a specific calendar event by ID", getEventSchema().shape, async (params) => { return await getEvent(params); } );