get-event
Retrieve detailed calendar event information using a specific event ID, enabling efficient management and tracking of Outlook meetings.
Instructions
Get details of a calendar event by its ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| eventId | Yes | ID of the event to retrieve |
Implementation Reference
- src/tools/event-read.ts:18-82 (handler)Executes the 'get-event' tool: authenticates, fetches event from Microsoft Graph API by ID, formats details (subject, times, location, attendees, URL) into markdown text response, handles auth and not-found errors.async ({ eventId }) => { const { graph, userEmail, authError } = await getGraphConfig(); if (authError) { return { content: [{ type: "text", text: `🔐 Authentication Required\n\n${authError}\n\nPlease complete the authentication and try again.` }] }; } // Retrieve the event const event = await graph.getEvent(eventId, userEmail); if (!event) { return { content: [ { type: "text", text: "Failed to retrieve the event. The event might not exist or there was an error. Check the logs for details.", }, ], }; } // Format the result for response const eventUrl = event.webLink || "No event URL available"; const startTime = event.start?.dateTime || "No start time available"; const endTime = event.end?.dateTime || "No end time available"; const timeZone = event.start?.timeZone || "No time zone information"; const location = event.location?.displayName || "No location specified"; // Format attendees if they exist let attendeesList = "None"; if (event.attendees && event.attendees.length > 0) { attendeesList = event.attendees.map((a: any) => { const name = a.emailAddress?.name || 'No name'; const email = a.emailAddress?.address || 'No email'; const type = a.type || 'required'; return `${name} (${email}) - ${type}`; }).join("\n "); } const successMessage = ` Calendar event details: Event ID: ${eventId} Subject: ${event.subject || "No subject"} Start: ${startTime} End: ${endTime} Time Zone: ${timeZone} Location: ${location} User: ${userEmail} Attendees: ${attendeesList} Event URL: ${eventUrl} `; return { content: [ { type: "text", text: successMessage, }, ], }; }
- src/tools/event-read.ts:15-17 (schema)Input schema using Zod: requires 'eventId' as string.{ eventId: z.string().describe("ID of the event to retrieve"), },
- src/tools/event-read.ts:11-83 (registration)Registers the 'get-event' tool on the MCP server via registerTool, providing name, description, input schema, and handler function.registerTool( server, "get-event", "Get details of a calendar event by its ID", { eventId: z.string().describe("ID of the event to retrieve"), }, async ({ eventId }) => { const { graph, userEmail, authError } = await getGraphConfig(); if (authError) { return { content: [{ type: "text", text: `🔐 Authentication Required\n\n${authError}\n\nPlease complete the authentication and try again.` }] }; } // Retrieve the event const event = await graph.getEvent(eventId, userEmail); if (!event) { return { content: [ { type: "text", text: "Failed to retrieve the event. The event might not exist or there was an error. Check the logs for details.", }, ], }; } // Format the result for response const eventUrl = event.webLink || "No event URL available"; const startTime = event.start?.dateTime || "No start time available"; const endTime = event.end?.dateTime || "No end time available"; const timeZone = event.start?.timeZone || "No time zone information"; const location = event.location?.displayName || "No location specified"; // Format attendees if they exist let attendeesList = "None"; if (event.attendees && event.attendees.length > 0) { attendeesList = event.attendees.map((a: any) => { const name = a.emailAddress?.name || 'No name'; const email = a.emailAddress?.address || 'No email'; const type = a.type || 'required'; return `${name} (${email}) - ${type}`; }).join("\n "); } const successMessage = ` Calendar event details: Event ID: ${eventId} Subject: ${event.subject || "No subject"} Start: ${startTime} End: ${endTime} Time Zone: ${timeZone} Location: ${location} User: ${userEmail} Attendees: ${attendeesList} Event URL: ${eventUrl} `; return { content: [ { type: "text", text: successMessage, }, ], }; } );
- src/index.ts:34-34 (registration)Top-level registration call in main server file, invoking registerEventReadTools which includes 'get-event' tool.registerEventReadTools(server);
- src/utils/graph-config.ts:113-113 (helper)Shared helper function providing Microsoft Graph client, user email, and auth error status, used by the handler for API access.export async function getGraphConfig() {