UNPKG

outlook-mcp

Version:

Comprehensive MCP server for Claude to access Microsoft Outlook and Teams via Microsoft Graph API - including Email, Calendar, Contacts, Tasks, Teams, Chats, and Online Meetings

59 lines (51 loc) 1.26 kB
/** * Delete event functionality */ const { callGraphAPI } = require('../utils/graph-api'); const { ensureAuthenticated } = require('../auth'); /** * Delete event handler * @param {object} args - Tool arguments * @returns {object} - MCP response */ async function handleDeleteEvent(args) { const { eventId } = args; if (!eventId) { return { content: [{ type: "text", text: "Event ID is required to delete an event." }] }; } try { // Get access token const accessToken = await ensureAuthenticated(); // Build API endpoint const endpoint = `me/events/${eventId}`; // Make API call await callGraphAPI(accessToken, 'DELETE', endpoint); return { content: [{ type: "text", text: `Event with ID ${eventId} has been successfully deleted.` }] }; } catch (error) { if (error.message === 'Authentication required') { return { content: [{ type: "text", text: "Authentication required. Please use the 'authenticate' tool first." }] }; } return { content: [{ type: "text", text: `Error deleting event: ${error.message}` }] }; } } module.exports = handleDeleteEvent;