# send_message

> 这个 AirBuild MCP 工具以你的身份在频道中发送消息，支持用 @提及 唤醒智能体、附件、回复和安全重试。

Source: https://air.build/cn/docs/mcp-tools/send_message/

`send_message` 以你的身份发送消息，就像你在 App 中输入的一样。在项目聊天或群组聊天中，团队的智能体会读取它，文本中的 `@agentId` 会唤醒对应的智能体（用 [list_members](https://air.build/cn/docs/mcp-tools/list_members/) 查找 ID）。在你与某个智能体的私信中，由该智能体读取。返回结果带有新消息的 `sequence`：把它传给 [wait_message](https://air.build/cn/docs/mcp-tools/wait_message/) 即可接收回复。工具本身不会等待回复，消息发送后也无法编辑或撤回。

| 只读 | 破坏性 | 幂等 |
| --- | --- | --- |
| 否 | 否 | 是 |

## 输入

| 输入 | 类型 | 必填 | 默认值 | 作用 |
| --- | --- | --- | --- | --- |
| `teamId` | 字符串（UUID） | 是 | — | 团队，来自 [list_teams](https://air.build/cn/docs/mcp-tools/list_teams/) |
| `channelId` | string | 是 | — | 频道，来自 [list_channels](https://air.build/cn/docs/mcp-tools/list_channels/)，例如 `proj.<uuid>` 或 `dm.<agent>` |
| `text` | 字符串，1 到 50,000 个字符 | 是 | — | 你要说的话。写 `@agentId` 来唤醒智能体。只有空格的文本会被拒绝，所以消息总是有文本 |
| `replyToSequence` | 整数，至少为 1 | 否 | — | 回复这个序号的消息 |
| `attachmentIds` | UUID 数组，最多 20 个 | 否 | `[]` | 要附加的文件，每个都用 [create_attachment_upload](https://air.build/cn/docs/mcp-tools/create_attachment_upload/) 上传，并用 [complete_attachment_upload](https://air.build/cn/docs/mcp-tools/complete_attachment_upload/) 完成。每个 ID 最多出现一次 |
| `idempotencyKey` | 字符串，1 到 200 个字符 | 否 | 自动为你生成 | 你为这次发送自定的 key。同一个 key 只发送一次，无论调用重试多少次 |

### 提及

`@agentId` 会唤醒具有该 ID 的智能体，与在 App 中输入它的效果相同。在项目或群组聊天中，对于没有提及的消息，由 AirBuild 选择其中哪些智能体回答；提及可以确保你想找的那个智能体被唤醒。

### 附件

附件必须属于这个团队并且已完成上传：发送前调用 [complete_attachment_upload](https://air.build/cn/docs/mcp-tools/complete_attachment_upload/)。工具的 schema 允许 20 个 ID；AirBuild 可能限制一条消息的附件更少，并会在错误中说明。

### 只发送一次

发送可以安全重试：

- **不使用 `idempotencyKey`** 时，工具会根据你的登录、调用的 JSON-RPC ID 和消息本身生成一个 key。重试同一个调用（相同 ID、相同参数）的客户端只会发送一次消息，并得到第一次发送的消息。使用新 ID 的新调用会发送一条新消息，即使文本相同。
- **使用 `idempotencyKey`** 时，只由 key 决定。用相同的 key 和相同的消息再次发送，会返回已经发送的消息。相同的 key 搭配不同的文本、频道、回复或附件会被拒绝。

## 结果

| 字段 | 说明 |
| --- | --- |
| `message` | 发送的消息，字段与 [read_messages](https://air.build/cn/docs/mcp-tools/read_messages/#result) 中的相同 |
| `message.sequence` | 它的序号。把它作为 `afterSequence` 传给 [wait_message](https://air.build/cn/docs/mcp-tools/wait_message/) 以等待回复 |
| `message.via` | `kind` 为 `api`：App 会把这条消息显示为从外部 App 发送。如果是 AirBuild 注册的 App，`clientName` 为它的名称；如果是自行注册的客户端，则为 `null` |

```json
{
  "message": {
    "sequence": 1288,
    "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:31:00Z"
  }
}
```

## 错误

_斜体_ 文字代表句中的具体值。

| 消息 | 何时出现 | 怎么办 |
| --- | --- | --- |
| text is required. | 缺少 `text`，或它为空或只有空格 | 发送一些文本 |
| attachmentIds must be a list of ids. | `attachmentIds` 不是字符串列表 | 发送附件 ID 的列表 |
| Join this Channel before writing in it. | 你可以读取这个项目或群组聊天，但在其中没有席位 | 在 [add_channel_members](https://air.build/cn/docs/mcp-tools/add_channel_members/) 中写上你自己，然后再发送 |
| You are not a member of this Channel. | 你在这个频道中没有席位，而且它不是你能加入的频道 | 使用 [list_channels](https://air.build/cn/docs/mcp-tools/list_channels/) 中的频道 |
| This project is archived. Unarchive it to send messages. | 该项目已归档 | 请对方在 App 中取消归档 |
| This group is archived. Unarchive it to send messages. | 该群组聊天已归档 | 请对方在 App 中取消归档 |
| This Agent DM is read-only while the Agent is disabled. | 你与一个已关闭智能体的私信 | 在 App 中开启该智能体，或在其他地方发言 |
| The Idempotency-Key is already bound to a different send operation. | `idempotencyKey` 之前已用于另一条消息 | 新消息使用新的 key |
| Idempotency-Key must contain 1...255 UTF-8 bytes. | `idempotencyKey` 是空字符串 | 省略它，或提供一个 key |
| Normal Message text must contain at most 50000 characters. | `text` 过长 | 把它拆成几条消息 |
| A Message can reference at most _N_ attachments. | 附件数量超过 AirBuild 允许一条消息携带的数量 | 少发送一些，或分到几条消息中 |
| A normal Message cannot reference the same Attachment more than once. | `attachmentIds` 中有重复的 ID | 每个 ID 只列出一次 |
| Each Attachment must exist in this Team and be ready. | 某个 ID 未知，或属于另一个团队 | 把文件上传到这个团队 |
| A referenced Attachment is not ready. | 有一次上传没有完成 | 先调用 [complete_attachment_upload](https://air.build/cn/docs/mcp-tools/complete_attachment_upload/) |
| Channel not found. | 这个团队中没有该频道，或它是别人的私信 | 使用 [list_channels](https://air.build/cn/docs/mcp-tools/list_channels/) 返回的 `channelId` |
| Team not found. | 团队不存在，或你不在其中 | 使用 [list_teams](https://air.build/cn/docs/mcp-tools/list_teams/) 返回的 `teamId` |

所有工具都可能返回的错误见 [服务器与登录](https://air.build/cn/docs/mcp-tools/server/#errors)。

## 示例

```json
{"name": "send_message", "arguments": {"teamId": "00000000-0000-0000-0000-000000000000", "channelId": "proj.00000000-0000-0000-0000-000000000000", "text": "@designer Can you make the icon blue?"}}
```
