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

74 lines (61 loc) 1.75 kB
/** * Tentative event functionality */ const { callGraphAPI } = require('../utils/graph-api'); const { ensureAuthenticated } = require('../auth'); /** * Tentative event handler * @param {object} args - Tool arguments * @returns {object} - MCP response */ async function handleTentativeEvent(args) { try { const { eventId, comment } = args; if (!eventId) { return { error: { code: -32602, message: "Event ID is required to respond tentatively to an event" } }; } // Get access token const accessToken = await ensureAuthenticated(); // Build API endpoint const endpoint = `me/events/${eventId}/tentativelyAccept`; // Request body const body = { comment: comment || "Tentatively accepted via API" }; console.error(`Tentatively accepting event: ${eventId}`); // Make API call await callGraphAPI(accessToken, 'POST', endpoint, body); return { content: [{ type: "text", text: `✅ Event tentatively accepted successfully! **Event ID:** ${eventId} **Response:** Tentatively Accepted **Comment:** ${comment || "Tentatively accepted via API"} Your tentative response has been sent to the event organizer.` }] }; } catch (error) { console.error('Error in handleTentativeEvent:', error); if (error.message === 'Authentication required') { return { error: { code: -32603, message: "Authentication required. Please use the 'authenticate' tool first." } }; } return { error: { code: -32603, message: `Failed to tentatively accept event: ${error.message}` } }; } } module.exports = handleTentativeEvent;