update_event
Modify existing Outlook calendar events by updating details like subject, time, location, or description using the event ID.
Instructions
Update an existing calendar event
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| eventId | Yes | Event ID to update | |
| subject | No | New event subject/title (optional) | |
| startDate | No | New start date in MM/DD/YYYY format (optional) | |
| startTime | No | New start time in HH:MM AM/PM format (optional) | |
| endDate | No | New end date in MM/DD/YYYY format (optional) | |
| endTime | No | New end time in HH:MM AM/PM format (optional) | |
| location | No | New event location (optional) | |
| body | No | New event description/body (optional) | |
| calendar | No | Calendar name (optional) |
Implementation Reference
- src/index.ts:332-377 (registration)Registers the update_event tool in the MCP server's tool list, including its description and input schema definition.{ name: "update_event", description: "Update an existing calendar event", inputSchema: { type: "object", properties: { eventId: { type: "string", description: "Event ID to update" }, subject: { type: "string", description: "New event subject/title (optional)" }, startDate: { type: "string", description: "New start date in MM/DD/YYYY format (optional)" }, startTime: { type: "string", description: "New start time in HH:MM AM/PM format (optional)" }, endDate: { type: "string", description: "New end date in MM/DD/YYYY format (optional)" }, endTime: { type: "string", description: "New end time in HH:MM AM/PM format (optional)" }, location: { type: "string", description: "New event location (optional)" }, body: { type: "string", description: "New event description/body (optional)" }, calendar: { type: "string", description: "Calendar name (optional)" } }, required: ["eventId"] } },
- src/index.ts:742-762 (handler)MCP server dispatch handler for update_event tool calls, which extracts parameters and delegates to OutlookManager.updateEvent.case 'update_event': { const result = await outlookManager.updateEvent({ eventId: (args as any)?.eventId, subject: (args as any)?.subject, startDate: (args as any)?.startDate, startTime: (args as any)?.startTime, endDate: (args as any)?.endDate, endTime: (args as any)?.endTime, location: (args as any)?.location, body: (args as any)?.body, calendar: (args as any)?.calendar }); return { content: [ { type: 'text', text: `${result.success ? '✅' : '❌'} **Event Update**\n\n${result.message}`, }, ], }; }
- src/outlook-manager.ts:741-817 (handler)Core implementation of the update_event tool in OutlookManager class. Parses input options, constructs PowerShell script to update Outlook appointment via COM, executes it, and returns success/error status.async updateEvent(options: { eventId: string; subject?: string; startDate?: string; startTime?: string; endDate?: string; endTime?: string; location?: string; body?: string; calendar?: string; }): Promise<{ success: boolean; message: string }> { try { const calendarName = options.calendar || ''; let startDateTime = ''; let endDateTime = ''; if (options.startDate && options.startTime) { startDateTime = `${options.startDate} ${options.startTime}`; } if (options.endDate && options.endTime) { endDateTime = `${options.endDate} ${options.endTime}`; } else if (startDateTime) { // Default to 30 minutes after start endDateTime = 'ADD30MIN'; } const script = ` try { Add-Type -AssemblyName "Microsoft.Office.Interop.Outlook" -ErrorAction Stop $outlook = New-Object -ComObject Outlook.Application -ErrorAction Stop $namespace = $outlook.GetNamespace("MAPI") # Get appointment $appointment = $namespace.GetItemFromID("${options.eventId.replace(/"/g, '""')}") if (-not $appointment) { throw "Event not found with ID: ${options.eventId.replace(/"/g, '""')}" } # Update properties ${options.subject ? `$appointment.Subject = "${options.subject.replace(/"/g, '""')}"` : ''} ${startDateTime ? `$appointment.Start = [DateTime]"${startDateTime.replace(/"/g, '""')}"` : ''} ${endDateTime === 'ADD30MIN' ? `$appointment.End = $appointment.Start.AddMinutes(30)` : endDateTime ? `$appointment.End = [DateTime]"${endDateTime.replace(/"/g, '""')}"` : ''} ${options.location ? `$appointment.Location = "${options.location.replace(/"/g, '""')}"` : ''} ${options.body ? `$appointment.Body = "${options.body.replace(/"/g, '""')}"` : ''} $appointment.Save() Write-Output ([PSCustomObject]@{ Success = $true } | ConvertTo-Json -Compress) } catch { Write-Output ([PSCustomObject]@{ Success = $false Error = $_.Exception.Message } | ConvertTo-Json -Compress) } `; const result = await this.executePowerShell(script); const cleanResult = result.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g, '').trim(); const data = JSON.parse(cleanResult); if (!data.Success) { throw new Error(data.Error || 'Failed to update event'); } return { success: true, message: 'Event updated successfully' }; } catch (error) { throw new Error(`Failed to update event: ${error instanceof Error ? error.message : String(error)}`); } }