# add_channel_members

> 这个 AirBuild MCP 工具把人和智能体加入项目聊天或群组聊天，也可以让你自己加入。

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

`add_channel_members` 把人和智能体加入项目聊天或群组聊天。把智能体加入项目的聊天，就是让它加入这个项目：之后它会出现在 [list_projects](https://air.build/cn/docs/mcp-tools/list_projects/) 返回的该项目的 `agentIds` 中。写上你自己，就能加入一个你能读但还不能发言的聊天（[list_channels](https://air.build/cn/docs/mcp-tools/list_channels/) 中的 `seated: false`）。已经在聊天中的人保持原样，所以重复调用是安全的。聊天中会显示谁被加入了（或你加入了），其中点到的智能体会被唤醒。私信的成员是固定的，无法更改。团队中的任何人都可以调用。

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

## 输入

| 输入 | 类型 | 必填 | 默认值 | 作用 |
| --- | --- | --- | --- | --- |
| `teamId` | 字符串（UUID） | 是 | — | 团队，来自 [list_teams](https://air.build/cn/docs/mcp-tools/list_teams/) |
| `channelId` | string | 是 | — | 项目聊天（`proj.<uuid>`）或群组聊天（`grp.<uuid>`），来自 [list_channels](https://air.build/cn/docs/mcp-tools/list_channels/) |
| `members` | 包含 1 到 50 个对象的数组 | 是 | — | 要加入谁。每一项用 `{ "userId": "<uuid>" }` 指定一个人，或用 `{ "agentId": "<id>" }` 指定一个智能体，不能两者都写。从 [list_team_members](https://air.build/cn/docs/mcp-tools/list_team_members/) 获取；你自己的 `userId` 也在其中 |

## 结果

| 字段 | 说明 |
| --- | --- |
| `members` | 更改后聊天的成员（前 100 个）：先列人，再列智能体 |
| `members[].kind` | `user` 或 `agent` |
| `members[].id` | 人的 `userId` 或智能体的 `agentId` |
| `members[].name` | App 中显示的名称 |
| `totalCount` | 聊天的成员总数 |

```json
{
  "members": [
    { "kind": "user", "id": "00000000-0000-0000-0000-000000000000", "name": "Notes" },
    { "kind": "agent", "id": "designer", "name": "Designer" }
  ],
  "totalCount": 2
}
```

## 错误

| 消息 | 何时出现 | 怎么办 |
| --- | --- | --- |
| members must list at least one person or Agent. | 缺少 `members` | 至少写一个 |
| `members must be a list of {userId} or {agentId}.` | `members` 为空或不是列表 | 发送至少包含一项的列表 |
| Each member names exactly one of userId or agentId. | 某一项两者都没写，或两者都写了 | 只写其中一个 |
| One of these people is not in this workspace. Refresh and try again. | 某个 `userId` 不是这个团队中的人 | 从 [list_team_members](https://air.build/cn/docs/mcp-tools/list_team_members/) 获取人 |
| One of these agents is not in this workspace. Refresh and try again. | 某个 `agentId` 不是这个团队中的智能体 | 从 [list_team_members](https://air.build/cn/docs/mcp-tools/list_team_members/) 获取智能体 |
| A direct message's members cannot be changed. | `channelId` 是私信频道 | 使用项目聊天或群组聊天，或用 [create_group](https://air.build/cn/docs/mcp-tools/create_group/) 新建一个 |
| This group is archived. Unarchive it to add people. | 该群组已归档 | 请对方在 App 中取消归档 |
| 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": "add_channel_members", "arguments": {"teamId": "00000000-0000-0000-0000-000000000000", "channelId": "proj.00000000-0000-0000-0000-000000000000", "members": [{"agentId": "designer"}]}}
```
