Skip to main content
Glama
xybstone

macOS Calendar MCP Server

by xybstone

create-event

Add new events to macOS Calendar with title, dates, and optional details like location and description.

Instructions

在macOS日历中创建新事件

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
calendarNo日历名称个人
titleYes事件标题
startDateYes开始时间,格式:YYYY-MM-DD HH:MM
endDateYes结束时间,格式:YYYY-MM-DD HH:MM
descriptionNo事件描述
locationNo事件地点

Implementation Reference

  • Handler for 'create-event' tool using MCP SDK. Formats dates, generates AppleScript to create event in specified calendar, executes via osascript.
    async createEvent(args) {
      const { calendar = '个人', title, startDate, endDate, description = '', location = '' } = args;
      
      const startInfo = this.formatDateForAppleScript(startDate);
      const endInfo = this.formatDateForAppleScript(endDate);
      
      const startTimeScript = this.generateTimeScript(startInfo, 'startTime');
      const endTimeScript = this.generateTimeScript(endInfo, 'endTime');
    
      const script = `
        tell application "Calendar"
          set theCalendar to calendar "${calendar}"
          
          ${startTimeScript}
          ${endTimeScript}
          
          make new event at end of events of theCalendar with properties {summary:"${title}", start date:startTime, end date:endTime, description:"${description}", location:"${location}"}
        end tell
      `;
    
      try {
        const result = execSync(`osascript -e '${script}'`, { encoding: 'utf8' });
        return {
          content: [
            {
              type: 'text',
              text: `✅ 事件创建成功!\n📅 日历: ${calendar}\n📝 标题: ${title}\n🕒 时间: ${startDate} - ${endDate}\n📍 地点: ${location || '无'}\n📄 描述: ${description || '无'}`,
            },
          ],
        };
      } catch (error) {
        throw new Error(`创建事件失败: ${error.message}`);
      }
    }
  • Handler for 'create-event' tool. Formats dates for AppleScript, creates event in macOS Calendar.
    createEvent(args) {
      const { calendar = "个人", title, startDate, endDate, description = "", location = "" } = args;
      
      const formattedStart = this.formatDateForAppleScript(startDate);
      const formattedEnd = this.formatDateForAppleScript(endDate);
    
      const script = `
        tell application "Calendar"
          set theCalendar to calendar "${calendar}"
          set startDate to date "${formattedStart}"
          set endDate to date "${formattedEnd}"
          
          make new event at end of events of theCalendar with properties {summary:"${title}", start date:startDate, end date:endDate, description:"${description}", location:"${location}"}
        end tell
      `;
    
      try {
        const result = execSync(`osascript -e '${script}'`, { encoding: 'utf8' });
        return {
          content: [{
            type: "text",
            text: `✅ 事件创建成功!\n📅 日历: ${calendar}\n📝 标题: ${title}\n🕒 时间: ${startDate} - ${endDate}\n📍 地点: ${location || '无'}\n📄 描述: ${description || '无'}`
          }]
        };
      } catch (error) {
        throw new Error(`创建事件失败: ${error.message}`);
      }
    }
  • Handler for 'create-event' tool in v1. Uses toLocaleString for date formatting to AppleScript format, executes osascript to create calendar event.
    createEvent(args) {
      const { calendar = "个人", title, startDate, endDate, description = "", location = "" } = args;
      
      // 转换时间格式
      const formatDate = (dateStr) => {
        const date = new Date(dateStr);
        return date.toLocaleString('en-US', {
          month: 'numeric',
          day: 'numeric', 
          year: 'numeric',
          hour: 'numeric',
          minute: '2-digit',
          hour12: true
        });
      };
    
      const formattedStart = formatDate(startDate);
      const formattedEnd = formatDate(endDate);
    
      const script = `
        tell application "Calendar"
          set theCalendar to calendar "${calendar}"
          set startDate to date "${formattedStart}"
          set endDate to date "${formattedEnd}"
          
          make new event at end of events of theCalendar with properties {summary:"${title}", start date:startDate, end date:endDate, description:"${description}", location:"${location}"}
        end tell
      `;
    
      try {
        const result = execSync(`osascript -e '${script}'`, { encoding: 'utf8' });
        return {
          content: [{
            type: "text",
            text: `✅ 事件创建成功!\n📅 日历: ${calendar}\n📝 标题: ${title}\n🕒 时间: ${startDate} - ${endDate}\n📍 地点: ${location || '无'}\n📄 描述: ${description || '无'}`
          }]
        };
      } catch (error) {
        throw new Error(`创建事件失败: ${error.message}`);
      }
    }
  • Input schema definition for the 'create-event' tool, defining parameters like calendar, title, dates, etc.
      name: 'create-event',
      description: '在macOS日历中创建新事件',
      inputSchema: {
        type: 'object',
        properties: {
          calendar: {
            type: 'string',
            description: '日历名称',
            default: '个人',
          },
          title: {
            type: 'string',
            description: '事件标题',
          },
          startDate: {
            type: 'string',
            description: '开始时间,格式:YYYY-MM-DD HH:MM',
          },
          endDate: {
            type: 'string',
            description: '结束时间,格式:YYYY-MM-DD HH:MM',
          },
          description: {
            type: 'string',
            description: '事件描述',
            default: '',
          },
          location: {
            type: 'string',
            description: '事件地点',
            default: '',
          },
        },
        required: ['title', 'startDate', 'endDate'],
        additionalProperties: false,
      },
    },
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure but only states the basic action. It doesn't mention whether this requires calendar permissions, what happens on creation failure, whether events are editable after creation, or any rate limits. For a mutation tool with zero annotation coverage, this leaves significant behavioral questions unanswered.

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 without any wasted words. It's appropriately sized and front-loaded with the essential information.

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?

For a mutation tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what happens after creation (success/failure responses), doesn't mention permission requirements, and provides no behavioral context. Given the tool's complexity (creating calendar events) and lack of structured metadata, the description should do more to guide the agent.

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 schema has 100% description coverage with clear parameter documentation, so the baseline is 3. The tool description adds no additional parameter information beyond what's already in the schema descriptions, but doesn't need to compensate for any gaps since schema coverage is complete.

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 action ('创建新事件' - create new event) and target resource ('在macOS日历中' - in macOS calendar), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'create-batch-events' or explain how this single-event creation differs from batch creation.

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 about when to use this tool versus alternatives. With siblings like 'create-batch-events' for multiple events and 'search-events' for finding existing events, the description offers no context about appropriate use cases, prerequisites, or when to choose this tool over others.

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