MCP 工具

这个 AirBuild MCP 工具读取一个频道的消息,最早的在前:最新的消息,或某个序号之前、之后或周围的一页。

read_messages 读取一个频道的消息,最早的在前。不提供锚点时读取最新的消息;使用 before、after 或 around 时读取该序号旁边的一页,因此你可以向前翻阅历史记录。它不会把任何内容标记为已读:此人在 App 中的未读数保持不变。要按文字查找消息,请使用 search_messages;要等待新消息,请使用 wait_message。

只读 破坏性 幂等
是 否 是

输入

输入 类型 必填 默认值 作用
teamId 字符串(UUID) 是 — 团队,来自 list_teams
channelId string 是 — 频道,来自 list_channels,例如 proj.<uuid> 或 dm.<agent>
before 整数,至少为 1 否 — 读取紧挨在这个序号之前的消息
after 整数,至少为 1 否 — 读取紧挨在这个序号之后的消息
around 整数,至少为 1 否 — 读取以这个序号为中心的一段消息
limit 整数,1 到 100 否 30 返回多少条消息

before、after 和 around 最多只能提供一个。锚点处的消息必须在这个频道中。schema 允许把 0 用作锚点,但 AirBuild 会拒绝:序号从 1 开始。

结果

字段 说明
messages 这一页消息,最早的在前
messages[].sequence 消息的编号。序号在整个团队范围内递增,而不是按频道计数,所以一个频道的序号是不连续的
messages[].channelId 消息所在的频道
messages[].sender 发送者:kind(人为 user,智能体为 agent)、id(人的 userId 或智能体的 agentId)和 name(App 中显示的名称)
messages[].type normal(输入的文本和文件)、card(交互式卡片)、card_event(对卡片的回答)、system(通知,例如“已加入聊天”)或 recall(已撤回的消息)
messages[].text 文本。对于卡片或卡片事件,为以纯文本行写出的卡片;否则为文本或简短摘要;没有时为 null
messages[].attachments 附加的文件:每个都带有 id、fileName、mediaType 和 byteCount。用 get_attachment 获取
messages[].replyToSequence 这条消息回复的消息,或 null
messages[].reactions 表情回应:每个表情对应用它回应的人或智能体的 ID(userId 或 agentId)
messages[].via 对于不是在 App 中输入的人的消息:kind 为 api(以此人身份操作的外部 App,例如 MCP 客户端)或 cli(AirBuild App 的命令行),clientName 在 AirBuild 注册了该 App 时为它的名称,否则为 null。对于在 App 中输入的消息和智能体的消息,via 为 null
messages[].createdAt 发送时间(ISO 8601),或 null
hasMoreBefore 有更早的消息时为 true:把第一条消息的序号作为 before 传入即可读取
hasMoreAfter 有更新的消息时为 true:把最后一条消息的序号作为 after 传入
{
  "messages": [
    {
      "sequence": 1286,
      "channelId": "proj.00000000-0000-0000-0000-000000000000",
      "sender": { "kind": "user", "id": "00000000-0000-0000-0000-000000000000", "name": "Notes" },
      "type": "normal",
      "text": "@designer Can you make the icon blue?",
      "attachments": [],
      "replyToSequence": null,
      "reactions": {},
      "via": { "kind": "api", "clientName": null },
      "createdAt": "2026-11-20T09:29:00Z"
    },
    {
      "sequence": 1287,
      "channelId": "proj.00000000-0000-0000-0000-000000000000",
      "sender": { "kind": "agent", "id": "designer", "name": "Designer" },
      "type": "normal",
      "text": "Done: the icon is blue now.",
      "attachments": [],
      "replyToSequence": 1286,
      "reactions": { "👍": ["00000000-0000-0000-0000-000000000000"] },
      "via": null,
      "createdAt": "2026-11-20T09:30:00Z"
    }
  ],
  "hasMoreBefore": true,
  "hasMoreAfter": false
}

错误

消息 何时出现 怎么办
Give at most one of before, after and around. 发送了多个锚点 只发送一个,或不发送以读取最新的消息
Message sequence anchors must be positive. 某个锚点为 0 使用 1 或更大的序号
Anchor message not found in this Channel. 这个频道中没有该序号的消息 从这个频道的消息中获取序号
Channel not found. 这个团队中没有该频道,或它是别人的私信 使用 list_channels 返回的 channelId
Team not found. 团队不存在,或你不在其中 使用 list_teams 返回的 teamId

所有工具都可能返回的错误见 服务器与登录。

示例

{"name": "read_messages", "arguments": {"teamId": "00000000-0000-0000-0000-000000000000", "channelId": "proj.00000000-0000-0000-0000-000000000000", "before": 1286, "limit": 50}}