Skip to main content
Glama
xybstone

macOS Calendar MCP Server

by xybstone

list-today-events

Retrieve today's scheduled events from macOS Calendar to view your daily agenda and manage time effectively.

Instructions

列出今天的事件

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
calendarNo日历名称个人

Implementation Reference

  • Main handler function for 'list-today-events' tool. Executes AppleScript to query today's events from macOS Calendar app and formats the output.
    async listTodayEvents(args) {
      const { calendar = '个人' } = args;
      
      const script = `
        tell application "Calendar"
          set theCalendar to calendar "${calendar}"
          set todayStart to (current date) - (time of (current date))
          set todayEnd to todayStart + (24 * hours) - 1
          
          set todayEvents to every event of theCalendar whose start date ≥ todayStart and start date ≤ todayEnd
          
          set eventList to {}
          repeat with anEvent in todayEvents
            set eventInfo to (summary of anEvent) & "|" & (start date of anEvent) & "|" & (end date of anEvent) & "|" & (description of anEvent) & "|" & (location of anEvent)
            set end of eventList to eventInfo
          end repeat
          
          return eventList as string
        end tell
      `;
    
      try {
        const result = execSync(`osascript -e '${script}'`, { encoding: 'utf8' });
        const events = result.trim();
        
        if (!events || events === '""') {
          return {
            content: [
              {
                type: 'text',
                text: `📅 ${calendar} - 今日无事件`,
              },
            ],
          };
        }
    
        const eventList = events.split(',').map(event => {
          const [title, start, end, desc, loc] = event.trim().split('|');
          return `📝 ${title}\n🕒 ${start} - ${end}${loc ? `\n📍 ${loc}` : ''}${desc ? `\n📄 ${desc}` : ''}`;
        }).join('\n\n');
    
        return {
          content: [
            {
              type: 'text',
              text: `📅 ${calendar} - 今日事件:\n\n${eventList}`,
            },
          ],
        };
      } catch (error) {
        throw new Error(`获取今日事件失败: ${error.message}`);
      }
    }
  • Input schema definition for the 'list-today-events' tool in the ListTools response.
    name: 'list-today-events',
    description: '列出今天的事件',
    inputSchema: {
      type: 'object',
      properties: {
        calendar: {
          type: 'string',
          description: '日历名称',
          default: '个人',
        },
      },
      additionalProperties: false,
    },
  • Tool registration in the switch statement within CallToolRequestSchema handler.
    case 'list-today-events':
      return await this.listTodayEvents(args);
  • Handler function for 'list-today-events' in v2 implementation.
    listTodayEvents(args) {
      const { calendar = "个人" } = args;
      
      const script = `
        tell application "Calendar"
          set theCalendar to calendar "${calendar}"
          set todayStart to (current date) - (time of (current date))
          set todayEnd to todayStart + (24 * hours) - 1
          
          set todayEvents to every event of theCalendar whose start date ≥ todayStart and start date ≤ todayEnd
          
          set eventList to {}
          repeat with anEvent in todayEvents
            set eventInfo to (summary of anEvent) & "|" & (start date of anEvent) & "|" & (end date of anEvent) & "|" & (description of anEvent) & "|" & (location of anEvent)
            set end of eventList to eventInfo
          end repeat
          
          return eventList as string
        end tell
      `;
    
      try {
        const result = execSync(`osascript -e '${script}'`, { encoding: 'utf8' });
        const events = result.trim();
        
        if (!events || events === '""') {
          return {
            content: [{
              type: "text",
              text: `📅 ${calendar} - 今日无事件`
            }]
          };
        }
    
        const eventList = events.split(',').map(event => {
          const [title, start, end, desc, loc] = event.trim().split('|');
          return `📝 ${title}\n🕒 ${start} - ${end}${loc ? `\n📍 ${loc}` : ''}${desc ? `\n📄 ${desc}` : ''}`;
        }).join('\n\n');
    
        return {
          content: [{
            type: "text",
            text: `📅 ${calendar} - 今日事件:\n\n${eventList}`
          }]
        };
      } catch (error) {
        throw new Error(`获取今日事件失败: ${error.message}`);
      }
    }
  • Handler function for 'list-today-events' in v1 implementation.
    listTodayEvents(args) {
      const { calendar = "个人" } = args;
      
      const script = `
        tell application "Calendar"
          set theCalendar to calendar "${calendar}"
          set todayStart to (current date) - (time of (current date))
          set todayEnd to todayStart + (24 * hours) - 1
          
          set todayEvents to every event of theCalendar whose start date ≥ todayStart and start date ≤ todayEnd
          
          set eventList to {}
          repeat with anEvent in todayEvents
            set eventInfo to (summary of anEvent) & "|" & (start date of anEvent) & "|" & (end date of anEvent) & "|" & (description of anEvent) & "|" & (location of anEvent)
            set end of eventList to eventInfo
          end repeat
          
          return eventList as string
        end tell
      `;
    
      try {
        const result = execSync(`osascript -e '${script}'`, { encoding: 'utf8' });
        const events = result.trim();
        
        if (!events || events === '""') {
          return {
            content: [{
              type: "text",
              text: `📅 ${calendar} - 今日无事件`
            }]
          };
        }
    
        const eventList = events.split(',').map(event => {
          const [title, start, end, desc, loc] = event.trim().split('|');
          return `📝 ${title}\n🕒 ${start} - ${end}${loc ? `\n📍 ${loc}` : ''}${desc ? `\n📄 ${desc}` : ''}`;
        }).join('\n\n');
    
        return {
          content: [{
            type: "text",
            text: `📅 ${calendar} - 今日事件:\n\n${eventList}`
          }]
        };
      } catch (error) {
        throw new Error(`获取今日事件失败: ${error.message}`);
      }
    }
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 describe what 'list' entails—whether it returns all events, paginates results, includes metadata like times/locations, or has any rate limits. For a read operation with zero annotation coverage, this leaves significant gaps in understanding the tool's behavior.

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 in Chinese that directly states the tool's purpose. It's front-loaded with the core action and resource, with no wasted words or redundant phrasing. Every part of the sentence earns its place by specifying the time scope.

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 tool's simplicity (1 parameter, no output schema, no annotations), the description is incomplete. It doesn't explain what 'events' include (e.g., meetings, reminders), how results are structured, or any limitations (e.g., max events returned). For a list operation that agents need to interpret results from, more context is needed despite the low complexity.

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?

Schema description coverage is 100%, with the single parameter 'calendar' documented as '日历名称' (calendar name) with a default of '个人' (personal). The description adds no additional meaning beyond the schema—it doesn't explain what calendars are available, how naming works, or implications of the default. Baseline 3 is appropriate since the schema does the heavy lifting.

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 '列出今天的事件' (List today's events) clearly states the verb ('list') and resource ('events') with a specific time scope ('today'). It distinguishes from siblings like 'list-week-events' and 'search-events' by specifying the time filter, but doesn't explicitly differentiate from 'list-calendars' which lists a different resource type.

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?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention when to choose 'list-today-events' over 'list-week-events' or 'search-events', nor does it specify prerequisites like required calendar access. The time scope 'today' is implied but not explicitly positioned against other filtering options.

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/xybstone/macos-calendar-mcp'

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