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
355 lines (352 loc) • 8.94 kB
JavaScript
/**
* Calendar module for Outlook MCP server
*/
const handleListEvents = require('./list');
const handleDeclineEvent = require('./decline');
const handleCreateEvent = require('./create');
const handleCancelEvent = require('./cancel');
const handleDeleteEvent = require('./delete');
const handleAcceptEvent = require('./accept');
const handleTentativeEvent = require('./tentative');
const { handleListCalendars, handleCreateCalendar, handleUpdateCalendar, handleDeleteCalendar } = require('./calendars');
const handleSearchEvents = require('./search');
const handleUpdateEvent = require('./update');
// Calendar tool definitions
const calendarTools = [
{
name: "list-events",
description: "Lists upcoming events from your calendar",
inputSchema: {
type: "object",
properties: {
count: {
type: "number",
description: "Number of events to retrieve (default: 10, max: 50)"
}
},
required: []
},
handler: handleListEvents
},
{
name: "decline-event",
description: "Declines a calendar event",
inputSchema: {
type: "object",
properties: {
eventId: {
type: "string",
description: "The ID of the event to decline"
},
comment: {
type: "string",
description: "Optional comment for declining the event"
}
},
required: ["eventId"]
},
handler: handleDeclineEvent
},
{
name: "create-event",
description: "Creates a new calendar event",
inputSchema: {
type: "object",
properties: {
subject: {
type: "string",
description: "The subject of the event"
},
start: {
type: "string",
description: "The start time of the event in ISO 8601 format"
},
end: {
type: "string",
description: "The end time of the event in ISO 8601 format"
},
attendees: {
type: "array",
items: {
type: "string"
},
description: "List of attendee email addresses"
},
body: {
type: "string",
description: "Optional body content for the event"
}
},
required: ["subject", "start", "end"]
},
handler: handleCreateEvent
},
{
name: "cancel-event",
description: "Cancels a calendar event",
inputSchema: {
type: "object",
properties: {
eventId: {
type: "string",
description: "The ID of the event to cancel"
},
comment: {
type: "string",
description: "Optional comment for cancelling the event"
}
},
required: ["eventId"]
},
handler: handleCancelEvent
},
{
name: "delete-event",
description: "Deletes a calendar event",
inputSchema: {
type: "object",
properties: {
eventId: {
type: "string",
description: "The ID of the event to delete"
}
},
required: ["eventId"]
},
handler: handleDeleteEvent
},
{
name: "accept-event",
description: "Accepts a calendar event invitation",
inputSchema: {
type: "object",
properties: {
eventId: {
type: "string",
description: "The ID of the event to accept"
},
comment: {
type: "string",
description: "Optional comment for accepting the event"
}
},
required: ["eventId"]
},
handler: handleAcceptEvent
},
{
name: "tentative-event",
description: "Responds tentatively to a calendar event invitation",
inputSchema: {
type: "object",
properties: {
eventId: {
type: "string",
description: "The ID of the event to respond tentatively to"
},
comment: {
type: "string",
description: "Optional comment for the tentative response"
}
},
required: ["eventId"]
},
handler: handleTentativeEvent
},
{
name: "list-calendars",
description: "Lists all calendars",
inputSchema: {
type: "object",
properties: {},
required: []
},
handler: handleListCalendars
},
{
name: "create-calendar",
description: "Creates a new calendar",
inputSchema: {
type: "object",
properties: {
name: {
type: "string",
description: "Name of the calendar"
},
color: {
type: "string",
description: "Color of the calendar"
}
},
required: ["name"]
},
handler: handleCreateCalendar
},
{
name: "update-calendar",
description: "Updates an existing calendar",
inputSchema: {
type: "object",
properties: {
calendarId: {
type: "string",
description: "ID of the calendar to update"
},
name: {
type: "string",
description: "New name for the calendar"
},
color: {
type: "string",
description: "New color for the calendar"
}
},
required: ["calendarId"]
},
handler: handleUpdateCalendar
},
{
name: "delete-calendar",
description: "Deletes a calendar",
inputSchema: {
type: "object",
properties: {
calendarId: {
type: "string",
description: "ID of the calendar to delete"
}
},
required: ["calendarId"]
},
handler: handleDeleteCalendar
},
{
name: "search-events",
description: "Searches for events using various criteria",
inputSchema: {
type: "object",
properties: {
query: {
type: "string",
description: "General search query (searches subject, body, location)"
},
startDate: {
type: "string",
description: "Start date for search range in ISO format"
},
endDate: {
type: "string",
description: "End date for search range in ISO format"
},
subject: {
type: "string",
description: "Search by event subject"
},
attendee: {
type: "string",
description: "Search by attendee name or email"
},
location: {
type: "string",
description: "Search by location"
},
organizer: {
type: "string",
description: "Search by organizer name"
},
calendarId: {
type: "string",
description: "Search within specific calendar"
},
count: {
type: "number",
description: "Number of results to return (default: 25, max: 50)"
},
showRecurring: {
type: "boolean",
description: "Include recurring series in results (default: true)"
}
},
required: []
},
handler: handleSearchEvents
},
{
name: "update-event",
description: "Updates an existing calendar event",
inputSchema: {
type: "object",
properties: {
eventId: {
type: "string",
description: "ID of the event to update"
},
subject: {
type: "string",
description: "New subject for the event"
},
start: {
type: "string",
description: "New start time in ISO format"
},
end: {
type: "string",
description: "New end time in ISO format"
},
location: {
type: "string",
description: "New location for the event"
},
body: {
type: "string",
description: "New body content for the event"
},
attendees: {
type: "array",
items: {
type: "string"
},
description: "New list of attendee email addresses"
},
isAllDay: {
type: "boolean",
description: "Whether the event is all day"
},
importance: {
type: "string",
enum: ["low", "normal", "high"],
description: "Event importance level"
},
categories: {
type: "array",
items: {
type: "string"
},
description: "List of categories for the event"
},
calendarId: {
type: "string",
description: "Calendar ID (if updating event in specific calendar)"
}
},
required: ["eventId"]
},
handler: handleUpdateEvent
}
];
module.exports = {
calendarTools,
handleListEvents,
handleDeclineEvent,
handleCreateEvent,
handleCancelEvent,
handleDeleteEvent,
handleAcceptEvent,
handleTentativeEvent,
handleListCalendars,
handleCreateCalendar,
handleUpdateCalendar,
handleDeleteCalendar,
handleSearchEvents,
handleUpdateEvent
};