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 列表。必须至少提供 conversationIds 或 threadIds 之一。支持批量更新,最多可更新 10 个条目。格式:spaces/{space}

threadIds[]

string

可选。要更新调用用户已读状态的会话 ID 列表。必须至少提供 conversationIds 或 threadIds 之一。支持批量更新,最多可更新 10 个条目。格式:spaces/{space}/threads/{thread}

输出架构

MarkAsReadResponse

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

map (key: integer, value: string)

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

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

failedThreadReadStates

map (key: integer, value: string)

失败的会话读取状态的映射。键是 threadIds 请求列表中线程的索引(从 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