MCP Tools Reference: chatmcp.googleapis.com

工具:mark_as_read

将 Google Chat 对话和话题标记为已读(针对调用用户)。

将调用用户的读取状态更新为所提供对话和/或消息串中最新消息的时间。

前提条件:

  • conversationIds(格式:spaces/{space})和 threadIds(格式:spaces/{space}/threads/{thread})中至少有一个不得为空。
  • 支持每次调用最多批量更新 10 个对话 ID 和 10 个线程 ID。

部分失败模型:

  • 该请求会单独处理每个对话/线程,并且不会以原子方式失败。
  • 响应包含 failedConversationReadStates 和 failedThreadReadStates 映射,其中映射键是请求中失败项的从 0 开始的索引,值是错误状态。
  • 如果失败映射为空,则表示所有请求的对话/主题均已成功标记为已读。

以下代码示例展示了如何使用 curl 调用 mark_as_read MCP 工具。

Curl 请求
curl --location 'https://chatmcp.googleapis.com/mcp/v1' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
--header 'content-type: application/json' \
--header 'accept: application/json, text/event-stream' \
--data '{
  "method": "tools/call",
  "params": {
    "name": "mark_as_read",
    "arguments": {
      // Provide these details according to the MCP tool specification.
    }
  },
  "jsonrpc": "2.0",
  "id": 1
}'

输入架构

MarkAsReadRequest

JSON 表示法
{
  "conversationIds": [
    string
  ],
  "threadIds": [
    string
  ]
}
字段
conversationIds[]

string

可选。要更新调用用户的读取状态的对话 ID 列表。必须提供 conversation_ids 和 thread_ids 中的至少一个。支持最多 10 个条目的批量更新。格式:spaces/{space}

threadIds[]

string

可选。要更新调用用户的读取状态的线程 ID 列表。必须提供 conversation_ids 和 thread_ids 中的至少一个。支持最多 10 个条目的批量更新。格式:spaces/{space}/threads/{thread}

输出架构

MarkAsReadResponse

JSON 表示法
{
  "failedConversationReadStates": {
    integer: string,
    ...
  },
  "failedThreadReadStates": {
    integer: string,
    ...
  }
}
字段
failedConversationReadStates

map (key: integer, value: string)

失败的对话读取状态的映射。键是 conversation_ids 请求列表中的对话索引(从 0 开始),值是错误消息。如果所有对话都成功,则此映射为空。

包含一系列 "key": value 对的对象。示例:{ "name": "wrench", "mass": "1.3kg", "count": "3" }。

failedThreadReadStates

map (key: integer, value: string)

失败的线程读取状态的映射。键是 thread_ids 请求列表中的线程索引(从 0 开始),值是错误消息。如果所有线程都成功,则此映射为空。

包含一系列 "key": value 对的对象。示例:{ "name": "wrench", "mass": "1.3kg", "count": "3" }。

FailedConversationReadStatesEntry

JSON 表示法
{
  "key": integer,
  "value": string
}
字段
key

integer

value

string

FailedThreadReadStatesEntry

JSON 表示法
{
  "key": integer,
  "value": string
}
字段
key

integer

value

string

工具注释

工具注释会发送给 MCP 客户端,用于描述指定工具的基本风险。大多数客户端会将这些提示视为不受信任的,但它们可用于确定何时向用户发送确认提示。

除了标题字符串之外,还定义了以下布尔值提示:

  • readOnlyHint:如果为 true,则工具不会修改其环境。默认值:false。
  • destructiveHint:如果为 true,则工具可以执行破坏性操作。如果为 false,则该工具只能执行添加操作。默认值:true。
  • idempotentHint:如果为 true,则使用相同实参重复调用该工具不会对其环境产生任何额外影响。默认值:false。
  • openWorldHint:如果为 true,则工具可以与外部实体的“开放世界”进行交互。如果为 false,则该工具只能与内部实体互动。例如,网络搜索工具是开放世界,而内存工具不是开放世界。

破坏性提示:✅ | 等幂性提示:✅ | 只读提示:❌ | 开放世界提示:❌

授权范围

需要以下 OAuth 范围之一:

  • https://www.googleapis.com/auth/chat.users.readstate