工具:suggest_time
建议一个或多个日历中的时间段。如需访问主日历,请在 attendee_emails 字段中添加“primary”。
此工具适用于以下类型的查询:
- 我们所有人什么时候都有空开会?
- 找一个我们两人都有空的 30 分钟时间段。
- 查看 jane.doe@google.com 是否在周一上午有空。
示例:
suggest_time(
attendeeEmails=['joedoe@gmail.com', 'janedoe@gmail.com'],
startTime='2024-09-10T00:00:00',
endTime='2024-09-17T00:00:00',
durationMinutes=60,
preferences={
'startHour': '09:00',
'endHour': '17:00',
'excludeWeekends': 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.
以下示例演示了如何使用 curl 调用 suggest_time MCP 工具。
| Curl 请求 |
|---|
curl --location 'https://calendarmcp.googleapis.com/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "suggest_time", "arguments": { // provide these details according to the tool MCP specification } }, "jsonrpc": "2.0", "id": 1 }' |
输入架构
针对 SuggestTime 的请求消息。
SuggestTimeRequest
| JSON 表示法 |
|---|
{
"attendeeEmails": [
string
],
"startTime": string,
"endTime": string,
"timeZone": string
"durationMinutes": integer
"preferences": {
object ( |
| 字段 | |
|---|---|
attendeeEmails[] |
必需。要查找空闲时间的参加者的电子邮件地址。 |
startTime |
必需。查询的时间间隔的开始时间,采用 ISO 8601 格式。 |
endTime |
必需。查询的时间间隔结束时间,采用 ISO 8601 格式。 |
联合字段
|
|
timeZone |
可选。时间值所用的时区。此字段接受 IANA 时区数据库名称,例如 |
联合字段
|
|
durationMinutes |
可选。空闲时间段的最短时长(以分钟为单位)。默认值为 30 分钟。 |
联合字段
|
|
preferences |
用于查找建议时间的偏好设置。 |
偏好设置
| JSON 表示法 |
|---|
{ "startHour": string "endHour": string "excludeWeekends": boolean "pageSize": integer } |
| 字段 | |
|---|---|
联合字段
|
|
startHour |
一天中的首选开始小时(例如 |
联合字段
|
|
endHour |
首选结束时间(例如 |
联合字段
|
|
excludeWeekends |
是否排除周末。 |
联合字段
|
|
pageSize |
要返回的时间段数量上限。默认值为 5。 |
输出架构
针对 SuggestTime 的响应消息。
SuggestTimeResponse
| JSON 表示法 |
|---|
{
"timeSlots": [
{
object ( |
| 字段 | |
|---|---|
timeSlots[] |
建议的时段列表。 |
TimeSlot
| JSON 表示法 |
|---|
{ "startTime": string, "endTime": string, "durationMinutes": integer } |
| 字段 | |
|---|---|
startTime |
空闲时间段的开始时间,采用 ISO 8601 格式的时间戳。 |
endTime |
空闲时间段的结束时间,采用 ISO 8601 格式的时间戳。 |
durationMinutes |
空闲时间段的时长(以分钟为单位)。 |
工具注释
破坏性提示:❌ | 等幂性提示:✅ | 只读提示:✅ | 开放世界提示:❌