get_calendars
List available calendars from Microsoft Outlook to view and manage your schedule directly through the MCP server integration.
Instructions
List available calendars
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/outlook-manager.ts:1073-1126 (handler)Core handler function that executes PowerShell script to list all available Outlook calendars (default and additional folders).async getCalendars(): Promise<any[]> { try { const script = ` try { Add-Type -AssemblyName "Microsoft.Office.Interop.Outlook" -ErrorAction Stop $outlook = New-Object -ComObject Outlook.Application -ErrorAction Stop $namespace = $outlook.GetNamespace("MAPI") # Build calendars array $calendars = @() # Add default calendar $calendars += [PSCustomObject]@{ Name = "Default" Owner = $namespace.CurrentUser.Name IsDefault = $true } # Add other calendars foreach ($folder in $namespace.Folders) { try { $calendarFolder = $folder.Folders("Calendar") if ($calendarFolder) { $calendars += [PSCustomObject]@{ Name = "$($folder.Name) - Calendar" Owner = $folder.Name IsDefault = $false } } } catch { } } Write-Output ($calendars | 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(); 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 get calendars: ${error instanceof Error ? error.message : String(error)}`); } }
- src/index.ts:820-833 (handler)MCP server tool call handler that invokes outlookManager.getCalendars() and formats the response.case 'get_calendars': { const calendars = await outlookManager.getCalendars(); return { content: [ { type: 'text', text: `📅 **Available Calendars**\nTotal: ${calendars.length} calendars\n\n` + calendars.map((calendar, index) => `${index + 1}. ${calendar.IsDefault ? '⭐' : '📅'} **${calendar.Name}**\n Owner: ${calendar.Owner}` ).join('\n') }, ], }; }
- src/index.ts:449-455 (registration)Tool registration in the MCP server's listTools response, including name, description, and empty input schema.name: "get_calendars", description: "List available calendars", inputSchema: { type: "object", properties: {} } }
- src/index.ts:451-454 (schema)Input schema definition for get_calendars tool (no required parameters).inputSchema: { type: "object", properties: {} }