Appearance
Calendar連携
Issue: #3 Calendar連携
概要
macOS標準カレンダーアプリを AppleScript で操作し、イベントの作成・確認・管理を行う。
ツール定義
list_today_events
今日の予定一覧を取得する。
python
@mcp.tool()
def list_today_events() -> str:
"""今日のカレンダーイベント一覧を取得する"""AppleScript:
applescript
tell application "Calendar"
set today to current date
set todayStart to today - (time of today)
set todayEnd to todayStart + (1 * days)
set eventList to {}
repeat with cal in calendars
repeat with evt in (events of cal whose start date >= todayStart and start date < todayEnd)
set end of eventList to {summary of evt, start date of evt, end date of evt, location of evt}
end repeat
end repeat
return eventList
end telllist_upcoming_events
直近N日間の予定を取得する。
python
@mcp.tool()
def list_upcoming_events(days: int = 7) -> str:
"""指定した日数分の今後の予定を取得する"""| パラメータ | 型 | 必須 | 説明 |
|---|---|---|---|
| days | int | No | 取得日数(デフォルト: 7) |
create_event
新しいイベントを作成する。
python
@mcp.tool()
def create_event(title: str, start_time: str, end_time: str, location: str = "", calendar_name: str = "") -> str:
"""カレンダーに新しいイベントを作成する"""| パラメータ | 型 | 必須 | 説明 |
|---|---|---|---|
| title | str | Yes | イベントタイトル |
| start_time | str | Yes | 開始日時 (例: "2026-04-03 14:00") |
| end_time | str | Yes | 終了日時 (例: "2026-04-03 15:00") |
| location | str | No | 場所 |
| calendar_name | str | No | カレンダー名(指定なしはデフォルト) |
delete_event
python
@mcp.tool()
def delete_event(title: str, date: str) -> str:
"""指定した日付のイベントを削除する"""search_events
python
@mcp.tool()
def search_events(keyword: str, days: int = 30) -> str:
"""キーワードでイベントを検索する"""