MCP Reference: calendarmcp.googleapis.com

Model Context Protocol (MCP) 伺服器可做為代理伺服器,在外部服務與大型語言模型 (LLM) 或 AI 應用程式之間傳輸脈絡、資料或功能。MCP 伺服器可將 AI 應用程式連結至資料庫和 Web 服務等外部系統,並將系統回覆轉換成 AI 應用程式可理解的格式。

MCP 工具

MCP 工具是 MCP 伺服器向 LLM 或 AI 應用程式公開的函式或可執行功能,可在現實世界中執行動作。

calendarmcp.googleapis.com MCP 伺服器提供下列工具:

MCP 工具
list_events

Lists calendar events in a given calendar satisfying the given conditions.

主要功能與特色:

  • 任何日曆 ID,可以是使用者的主要日曆或其他日曆。
  • 關鍵字比對。
  • 時間範圍篩選。
  • 擷取符合時間和關鍵字限制的所有事件。

在下列情況下,請改用 search_events 工具:

  • 您需要找出最相關的 (前 K 個) 事件,而不是滿足限制條件的所有事件。
  • 您需要語意搜尋功能。
  • 您只在搜尋使用者主要日曆中的特定資訊。

這項工具適用於以下查詢:

  • 明天日曆上有什麼活動?
  • 2025 年 7 月 14 日的日曆上有哪些活動?
  • 我下週有哪些會議?
  • 我今天下午有任何會議衝突嗎?

範例:

list_events(
    start_time='2024-09-17T06:00:00',
    end_time='2024-09-17T12:00:00',
    page_size=10
)
# Returns up to 10 calendar events between 6:00 AM and 12:00 PM on September 17, 2024 from the user's primary calendar.
get_event

從指定日曆傳回單一活動。

這項工具適用於以下查詢:

  • 取得團隊會議的詳細資料。
  • Show me the event with id event123 on my calendar.

範例:

get_event(
    event_id='event123'
)
# Returns the event details for the event with id `event123` on the user's primary calendar.
list_calendars

傳回使用者日曆清單中的日曆。

這項工具適用於以下查詢:

  • 我有哪些日曆?

範例:

list_calendars()
# Returns all calendars the authenticated user has access to.
suggest_time

建議一或多個日曆中的時間範圍。如要存取主要日曆,請在 attendee_emails 欄位中新增「primary」。

這項工具適用於以下查詢:

  • 我們何時都有空開會?
  • 找出我們兩人都有空的 30 分鐘時段。
  • 確認 jane.doe@google.com 週一上午是否有空。

範例:

suggest_time(
    attendee_emails=['joedoe@gmail.com', 'janedoe@gmail.com'],
    start_time='2024-09-10T00:00:00',
    end_time='2024-09-17T00:00:00',
    duration_minutes=60,
    preferences={
        'start_hour': '09:00',
        'end_hour': '17:00',
        'exclude_weekends': True
    }
)
# Returns up to 5 suggested time slots where both users are available for at least one hour between 9:00 AM and 5:00 PM on weekdays from September 10 through September 16, 2024.
create_event

建立日曆活動。

這項工具適用於以下查詢:

  • 在我的日曆中新增一個明天下午 2 點的活動,取名為「與 Jane 會議」。
  • 安排下週一上午 10 點到 11 點與 john.doe@google.com 開會。

範例:

create_event(
    summary='Meeting with Jane',
    start_time='2024-09-17T14:00:00',
    end_time='2024-09-17T15:00:00'
)
# Creates an event on the primary calendar for September 17, 2024 from 2pm to 3pm called 'Meeting with Jane'.
update_event

更新日曆活動。

這項工具適用於以下查詢:

  • 將「與 Jane 會議」活動延後一小時。
  • 明天在會議中加入 john.doe@google.com

範例:

update_event(
    event_id='event123',
    summary='Meeting with Jane and John'
)
# Updates the summary of event with id 'event123' on the primary calendar to 'Meeting with Jane and John'.
delete_event

刪除日曆活動。

這項工具適用於以下查詢:

  • 刪除我日曆上 ID 為 event123 的活動。

如要取消或拒絕活動,請改用 respond_to_event 工具。

範例:

delete_event(
    event_id='event123'
)
# Deletes the event with id 'event123' on the user's primary calendar.
respond_to_event

回覆活動。

這項工具適用於以下查詢:

  • 接受日曆上 ID 為 event123 的活動。
  • 拒絕與小珍的會議。
  • 取消下一場會議。
  • 暫時接受規劃會議邀請。

範例:

respond_to_event(
    event_id='event123',
    response_status='accepted'
)
# Responds with status 'accepted' to the event with id 'event123' on the user's primary calendar.

取得 MCP 工具規格

如要取得 MCP 伺服器中所有工具的 MCP 工具規格,請使用 tools/list 方法。以下範例說明如何使用 curl 列出 MCP 伺服器中目前可用的所有工具及其規格。

Curl 要求
curl --location 'https://calendarmcp.googleapis.com/mcp' \
--header 'content-type: application/json' \
--header 'accept: application/json, text/event-stream' \
--data '{
    "method": "tools/list",
    "jsonrpc": "2.0",
    "id": 1
}'