delete-event
Remove a calendar event from Microsoft Outlook by specifying its event ID using the MCP server tool for scheduling and managing meetings.
Instructions
Delete a calendar event
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| eventId | Yes | ID of the event to delete |
Implementation Reference
- src/tools/event-delete.ts:18-66 (handler)The asynchronous handler function that performs the actual deletion of the calendar event using Microsoft Graph API. It checks authentication, retrieves event details, deletes the event, and returns appropriate success or error messages.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.` }] }; } // First get the event details to confirm what's being deleted const event = await graph.getEvent(eventId, userEmail); if (!event) { return { content: [ { type: "text", text: "Could not find the event to delete. Please check the event ID.", }, ], }; } // Delete the event const success = await graph.deleteEvent(eventId, userEmail); if (!success) { return { content: [ { type: "text", text: "Failed to delete calendar event. Check the logs for details.", }, ], }; } // Format the result for response const successMessage = `Calendar event deleted successfully! Event ID: ${eventId}`; return { content: [ { type: "text", text: successMessage, }, ], }; }
- src/tools/event-delete.ts:15-17 (schema)Zod input schema defining the required 'eventId' parameter as a string with description.{ eventId: z.string().describe("ID of the event to delete"), },
- src/tools/event-delete.ts:11-67 (registration)Registration of the 'delete-event' tool using registerTool, including name, description, input schema, and inline handler function.registerTool( server, "delete-event", "Delete a calendar event", { eventId: z.string().describe("ID of the event to delete"), }, 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.` }] }; } // First get the event details to confirm what's being deleted const event = await graph.getEvent(eventId, userEmail); if (!event) { return { content: [ { type: "text", text: "Could not find the event to delete. Please check the event ID.", }, ], }; } // Delete the event const success = await graph.deleteEvent(eventId, userEmail); if (!success) { return { content: [ { type: "text", text: "Failed to delete calendar event. Check the logs for details.", }, ], }; } // Format the result for response const successMessage = `Calendar event deleted successfully! Event ID: ${eventId}`; return { content: [ { type: "text", text: successMessage, }, ], }; } );