Skip to main content
Glama

list_events

Retrieve calendar events from Microsoft Outlook within a specified date range. Use this tool to view scheduled appointments and meetings by providing start and end dates.

Instructions

List calendar events within a specified date range

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
startDateYesStart date (ISO 8601 format)
endDateNoEnd date (ISO 8601 format, optional)
calendarNoCalendar name (optional)

Implementation Reference

  • src/index.ts:310-331 (registration)
    Tool registration in the MCP server tools list, including name, description, and input schema definition.
    {
      name: "list_events",
      description: "List calendar events within a specified date range",
      inputSchema: {
        type: "object",
        properties: {
          startDate: {
            type: "string",
            description: "Start date (ISO 8601 format)"
          },
          endDate: {
            type: "string",
            description: "End date (ISO 8601 format, optional)"
          },
          calendar: {
            type: "string",
            description: "Calendar name (optional)"
          }
        },
        required: ["startDate"]
      }
    },
  • MCP server request handler that processes 'list_events' tool calls, invokes outlookManager.listEvents, and formats the response.
    case 'list_events': {
      const events = await outlookManager.listEvents({
        startDate: new Date((args as any)?.startDate),
        endDate: (args as any)?.endDate ? new Date((args as any)?.endDate) : undefined,
        calendar: (args as any)?.calendar
      });
      return {
        content: [
          {
            type: 'text',
            text: `📅 **Calendar Events**\nTotal: ${events.length} events\n\n` +
                 events.map((event, index) => 
                   `${index + 1}. **${event.Subject}**\n   📍 ${event.Location || 'No location'}\n   🕐 ${event.Start} - ${event.End}\n   📋 ${event.Body ? event.Body.substring(0, 100) + '...' : 'No description'}\n   ID: ${event.Id}\n`
                 ).join('\n')
          },
        ],
      };
    }
  • Core handler function listEvents in OutlookManager that generates and executes PowerShell script to retrieve Outlook calendar events within a date range using COM interop.
    async listEvents(options: {
      startDate: Date;
      endDate?: Date;
      calendar?: string;
    }): Promise<any[]> {
      try {
        const endDate = options.endDate || options.startDate;
        const calendarName = options.calendar || '';
        
        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 calendar
            ${calendarName ? `
            $calendar = $null
            foreach ($folder in $namespace.Folders) {
              if ($folder.Name -eq "${calendarName.replace(/"/g, '""')}") {
                $calendar = $folder.Folders("Calendar")
                break
              }
            }
            if (-not $calendar) { throw "Calendar not found: ${calendarName.replace(/"/g, '""')}" }
            ` : `
            $calendar = $namespace.GetDefaultFolder(9)
            `}
            
            # Create filter for date range
            $startDate = [DateTime]"${options.startDate.toISOString()}"
            $endDate = [DateTime]"${endDate.toISOString()}".AddDays(1)
            $filter = "[Start] >= '$($startDate.ToString('g'))' AND [End] <= '$($endDate.ToString('g'))'"
            
            # Get events
            $items = $calendar.Items.Restrict($filter)
            $items.Sort("[Start]")
            
            # Build JSON array
            $events = @()
            foreach ($item in $items) {
              $events += [PSCustomObject]@{
                Id = $item.EntryID
                Subject = $item.Subject
                Start = $item.Start.ToString("yyyy-MM-ddTHH:mm:ss")
                End = $item.End.ToString("yyyy-MM-ddTHH:mm:ss")
                Location = if ($item.Location) { $item.Location } else { "" }
                Body = if ($item.Body) { $item.Body } else { "" }
                BusyStatus = $item.BusyStatus
                IsAllDayEvent = $item.AllDayEvent
                Organizer = if ($item.Organizer) { $item.Organizer } else { "" }
                RequiredAttendees = if ($item.RequiredAttendees) { $item.RequiredAttendees } else { "" }
              }
            }
            
            Write-Output ($events | ConvertTo-Json -Compress)
            
          } catch {
            Write-Output ([PSCustomObject]@{
              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();
        
        if (!cleanResult || cleanResult === '') {
          return [];
        }
        
        const data = JSON.parse(cleanResult);
        
        if (data.Error) {
          throw new Error(data.Error);
        }
        
        return Array.isArray(data) ? data : [data];
      } catch (error) {
        throw new Error(`Failed to list events: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('List') but doesn't mention whether this is a read-only operation, what permissions are required, how results are returned (e.g., pagination), or any rate limits. This is inadequate for a tool that likely accesses user data.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core functionality without unnecessary words. Every part ('List calendar events within a specified date range') directly contributes to understanding the tool's purpose, making it optimally concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It doesn't address behavioral aspects like safety, permissions, or result format, which are critical for a tool that lists personal calendar events. For a 3-parameter tool with no structured safety hints, this description leaves significant gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description mentions 'date range' which aligns with the 'startDate' and 'endDate' parameters in the schema, but adds no additional meaning beyond what the schema already provides (100% coverage). It doesn't explain the 'calendar' parameter's purpose or how date ranges are interpreted, so it meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('List') and resource ('calendar events') with scope ('within a specified date range'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'find_free_slots' or 'get_calendars', which also deal with calendar data but serve different purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'find_free_slots' (for availability) or 'get_calendars' (for calendar metadata). It lacks any mention of prerequisites, exclusions, or typical use cases, leaving the agent to infer usage from context alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cqyefeng119/windows-outlook-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server