# start_picture_upload

> 这个 AirBuild MCP 工具开始设置一张图片：团队的、项目的、智能体的照片、群组聊天的图片，或聊天的墙纸。

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

`start_picture_upload` 是设置图片三个步骤中的第一步：团队的图片、项目的图片、智能体的照片、群组聊天的图片，或聊天的墙纸。它返回一个上传链接和一条现成的命令。工具本身不传输图片：你用那条命令上传字节（一次 HTTP PUT），然后用相同的输入和 `uploadId` 调用 [finish_picture_upload](https://air.build/cn/docs/mcp-tools/finish_picture_upload/)。在此之前，App 中不会有任何变化。团队的图片只有拥有者可以设置；其他图片团队中的任何人都可以设置。

1. 用目标、图片的类型及其确切字节数调用 `start_picture_upload`。
2. 在 `expiresAt` 之前运行 `howTo`，并把 `<path-to-image>` 替换为文件。
3. 调用 [finish_picture_upload](https://air.build/cn/docs/mcp-tools/finish_picture_upload/)。

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

## 输入

| 输入 | 类型 | 必填 | 默认值 | 作用 |
| --- | --- | --- | --- | --- |
| `teamId` | 字符串（UUID） | 是 | — | 团队，来自 [list_teams](https://air.build/cn/docs/mcp-tools/list_teams/) |
| `target` | `team`、`project`、`agent`、`group` 或 `wallpaper` | 是 | — | 哪张图片：见 [目标](https://air.build/cn/docs/mcp-tools/start_picture_upload/#targets) |
| `targetId` | string | 除 `team` 外都需要 | — | 图片所属的项目、智能体或聊天：见 [目标](https://air.build/cn/docs/mcp-tools/start_picture_upload/#targets)。`team` 不使用 |
| `mediaType` | `image/jpeg`、`image/png` 或 `image/webp` | 是 | — | 图片的格式 |
| `byteCount` | 整数，至少为 1 | 是 | — | 图片的确切字节数。最大 2 MB（2097152 字节）；墙纸最大 8 MB（8388608 字节） |

### 目标

| `target` | 图片 | `targetId` | 谁可以设置 |
| --- | --- | --- | --- |
| `team` | 团队的图片 | — | 团队的拥有者 |
| `project` | 项目的图片 | 来自 [list_projects](https://air.build/cn/docs/mcp-tools/list_projects/) 的 `projectId` | 团队中的任何人 |
| `agent` | 智能体的照片 | 来自 [list_team_members](https://air.build/cn/docs/mcp-tools/list_team_members/) 的 `agentId` | 团队中的任何人 |
| `group` | 群组聊天的图片 | 来自 [list_channels](https://air.build/cn/docs/mcp-tools/list_channels/) 的群组聊天 `channelId`（`grp.<uuid>`） | 能看到该群组的任何人 |
| `wallpaper` | 聊天的墙纸，聊天中的所有人都能看到 | 来自 [list_channels](https://air.build/cn/docs/mcp-tools/list_channels/) 的项目聊天、群组聊天或私信的 `channelId` | 能看到该聊天的任何人 |

## 结果

| 字段 | 说明 |
| --- | --- |
| `uploadId` | 上传的 ID，供 [finish_picture_upload](https://air.build/cn/docs/mcp-tools/finish_picture_upload/) 使用 |
| `uploadUrl` | 字节的上传位置。请把它当作机密：任何拿到它的人在它过期前都可以上传 |
| `expiresAt` | `uploadUrl` 失效的时间（ISO 8601） |
| `howTo` | 一条把文件上传到 `uploadUrl` 的 `curl` 命令。把 `<path-to-image>` 替换为文件 |

```json
{
  "uploadId": "00000000-0000-0000-0000-000000000000",
  "uploadUrl": "https://<upload-host>/<path>",
  "expiresAt": "2026-11-20T10:00:00Z",
  "howTo": "curl -sS -X PUT -H 'Content-Type: image/png' --upload-file <path-to-image> 'https://<upload-host>/<path>'"
}
```

## 错误

_斜体_ 文字代表句中的具体值。除 `wallpaper` 外，所有目标的 _Picture_ 都是 `Avatar`，该目标的则是 `Wallpaper`。

| 消息 | 何时出现 | 怎么办 |
| --- | --- | --- |
| target is one of team, project, agent, group, wallpaper. | `target` 是其他值 | 使用这五个之一 |
| targetId is required. | `target` 不是 `team`，且缺少 `targetId` | 提供项目、智能体或聊天：见 [目标](https://air.build/cn/docs/mcp-tools/start_picture_upload/#targets) |
| targetId is not a valid id. Use one from the list tools. | `targetId` 不是 `agentId` 或 `channelId` | 从 [目标](https://air.build/cn/docs/mcp-tools/start_picture_upload/#targets) 中列出的工具获取 |
| targetId must be a UUID, from the list tools. | `target` 为 `project`，但 `targetId` 不是 UUID | 从 [list_projects](https://air.build/cn/docs/mcp-tools/list_projects/) 获取 `projectId` |
| An Avatar must contain at least one byte. | `byteCount` 为 `0`（对于墙纸，消息以“A Wallpaper”开头） | 发送图片的真实大小 |
| The _Picture_ exceeds the _N_-byte limit. | `byteCount` 超出上限 | 把图片缩小 |
| _Picture_ must be a JPEG, PNG, or WebP image. | `mediaType` 是其他格式 | 转换图片格式 |
| Only the Team's owner can change the Team's picture. | `target` 为 `team`，但你不是拥有者 | 请拥有者操作 |
| Only a group has a picture of its own. | `target` 为 `group`，但该聊天是项目聊天或私信 | 对于项目，请使用 `target: "project"`；私信没有图片 |
| Project not found. | 这个团队中没有该 `targetId` 的项目 | 从 [list_projects](https://air.build/cn/docs/mcp-tools/list_projects/) 获取 |
| Team member not found. | 团队中没有该 `targetId` 的智能体 | 从 [list_team_members](https://air.build/cn/docs/mcp-tools/list_team_members/) 获取 |
| Channel not found. | 这个团队中没有该聊天，或你看不到它 | 使用 [list_channels](https://air.build/cn/docs/mcp-tools/list_channels/) 返回的 `channelId` |
| Image storage isn't available right now. Try again later. | 目前无法存储图片 | 稍后再试 |
| 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": "start_picture_upload", "arguments": {"teamId": "00000000-0000-0000-0000-000000000000", "target": "agent", "targetId": "designer", "mediaType": "image/png", "byteCount": 48213}}
```
