list_events
Retrieve and display calendar events within a specified date range, including recurring instances, using the Microsoft MCP server. Ideal for managing and organizing Outlook schedules efficiently.
Instructions
List calendar events within specified date range, including recurring event instances
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account_id | Yes | ||
| days_ahead | No | ||
| days_back | No | ||
| include_details | No |
Implementation Reference
- src/microsoft_mcp/tools.py:474-505 (handler)The handler function for the 'list_events' tool. It queries the Microsoft Graph API's /me/calendarView endpoint to list calendar events within a specified date range, handling recurring events, with options for date range and detail level.@mcp.tool def list_events( account_id: str, days_ahead: int = 7, days_back: int = 0, include_details: bool = True, ) -> list[dict[str, Any]]: """List calendar events within specified date range, including recurring event instances""" now = dt.datetime.now(dt.timezone.utc) start = (now - dt.timedelta(days=days_back)).isoformat() end = (now + dt.timedelta(days=days_ahead)).isoformat() params = { "startDateTime": start, "endDateTime": end, "$orderby": "start/dateTime", "$top": 100, } if include_details: params["$select"] = ( "id,subject,start,end,location,body,attendees,organizer,isAllDay,recurrence,onlineMeeting,seriesMasterId" ) else: params["$select"] = "id,subject,start,end,location,organizer,seriesMasterId" # Use calendarView to get recurring event instances events = list( graph.request_paginated("/me/calendarView", account_id, params=params) ) return events