outlook-mcp/calendar/decline.js
Seton Carmichael a7886b5b2b Initial commit: Outlook MCP Server v1.0.0
MCP server providing Microsoft Outlook integration via Graph API:
- Email: list, search, read, send, thread reconstruction
- Calendar: list, create, decline, cancel, delete events
- Folders: list, create, move emails
- Inbox rules: list, create, reorder
- MSAL device code flow auth with persistent token cache
- Test mode with mock data
- Comprehensive README with setup, config, and tool reference

20 MCP tools across 5 modules. Node.js >= 14. MIT license.
2026-06-21 19:39:31 -04:00

64 lines
No EOL
1.4 KiB
JavaScript

/**
* Decline event functionality
*/
const { callGraphAPI } = require('../utils/graph-api');
const { ensureAuthenticated } = require('../auth');
/**
* Decline event handler
* @param {object} args - Tool arguments
* @returns {object} - MCP response
*/
async function handleDeclineEvent(args) {
const { eventId, comment } = args;
if (!eventId) {
return {
content: [{
type: "text",
text: "Event ID is required to decline an event."
}]
};
}
try {
// Get access token
const accessToken = await ensureAuthenticated();
// Build API endpoint
const endpoint = `me/events/${eventId}/decline`;
// Request body
const body = {
comment: comment || "Declined via API"
};
// Make API call
await callGraphAPI(accessToken, 'POST', endpoint, body);
return {
content: [{
type: "text",
text: `Event with ID ${eventId} has been successfully declined.`
}]
};
} 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 declining event: ${error.message}`
}]
};
}
}
module.exports = handleDeclineEvent;