# start_picture_upload

> 這個 AirBuild MCP 工具會開始設定一張圖片：團隊的、專案的、Agent 的照片、群組聊天的圖片，或聊天的背景圖片。

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

`start_picture_upload` 是設定圖片三個步驟中的第一步：團隊的圖片、專案的圖片、Agent 的照片、群組聊天的圖片，或聊天的背景圖片。它會傳回一個上傳連結和一個現成的指令。工具本身不會傳輸圖片：你用那個指令上傳位元組（一次 HTTP PUT），然後用相同的輸入和 `uploadId` 呼叫 [finish_picture_upload](https://air.build/tw/docs/mcp-tools/finish_picture_upload/)。在此之前，App 中不會有任何變化。團隊的圖片只有擁有者可以設定；其他圖片團隊中的任何人都可以設定。

1. 用目標、圖片的類型及其確切位元組數呼叫 `start_picture_upload`。
2. 在 `expiresAt` 之前執行 `howTo`，並把 `<path-to-image>` 替換為檔案。
3. 呼叫 [finish_picture_upload](https://air.build/tw/docs/mcp-tools/finish_picture_upload/)。

| 唯讀 | 破壞性 | 冪等 |
| --- | --- | --- |
| 否 | 否 | 否 |

## 輸入

| 輸入 | 類型 | 必填 | 預設值 | 作用 |
| --- | --- | --- | --- | --- |
| `teamId` | 字串（UUID） | 是 | — | 團隊，來自 [list_teams](https://air.build/tw/docs/mcp-tools/list_teams/) |
| `target` | `team`、`project`、`agent`、`group` 或 `wallpaper` | 是 | — | 哪張圖片：請參閱 [目標](https://air.build/tw/docs/mcp-tools/start_picture_upload/#targets) |
| `targetId` | string | 除了 `team` 以外都需要 | — | 圖片所屬的專案、Agent 或聊天：請參閱 [目標](https://air.build/tw/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/tw/docs/mcp-tools/list_projects/) 的 `projectId` | 團隊中的任何人 |
| `agent` | Agent 的照片 | 來自 [list_team_members](https://air.build/tw/docs/mcp-tools/list_team_members/) 的 `agentId` | 團隊中的任何人 |
| `group` | 群組聊天的圖片 | 來自 [list_channels](https://air.build/tw/docs/mcp-tools/list_channels/) 的群組聊天 `channelId`（`grp.<uuid>`） | 能看到該群組的任何人 |
| `wallpaper` | 聊天的背景圖片，聊天中的所有人都看得到 | 來自 [list_channels](https://air.build/tw/docs/mcp-tools/list_channels/) 的專案聊天、群組聊天或私訊的 `channelId` | 能看到該聊天的任何人 |

## 結果

| 欄位 | 說明 |
| --- | --- |
| `uploadId` | 上傳的 ID，供 [finish_picture_upload](https://air.build/tw/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` | 提供專案、Agent 或聊天：請參閱 [目標](https://air.build/tw/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/tw/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/tw/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/tw/docs/mcp-tools/list_projects/) 取得 |
| Team member not found. | 團隊中沒有該 `targetId` 的 Agent | 從 [list_team_members](https://air.build/tw/docs/mcp-tools/list_team_members/) 取得 |
| Channel not found. | 這個團隊中沒有該聊天，或你看不到它 | 使用 [list_channels](https://air.build/tw/docs/mcp-tools/list_channels/) 傳回的 `channelId` |
| Image storage isn't available right now. Try again later. | 目前無法儲存圖片 | 稍後再試 |
| Team not found. | 團隊不存在，或你不在其中 | 使用 [list_teams](https://air.build/tw/docs/mcp-tools/list_teams/) 傳回的 `teamId` |

所有工具都可能傳回的錯誤，請參閱 [伺服器與登入](https://air.build/tw/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}}
```
