# complete_attachment_upload

> 這個 AirBuild MCP 工具會對照宣告的資訊檢查已上傳的檔案，並讓附件可以傳送。

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

`complete_attachment_upload` 會完成以 [create_attachment_upload](https://air.build/tw/docs/mcp-tools/create_attachment_upload/) 開始的上傳：在你用 `PUT` 傳送位元組之後，它會檢查上傳檔案的大小和媒體類型是否與你宣告的相同，並把附件標示為 `ready`。之後 [send_message](https://air.build/tw/docs/mcp-tools/send_message/) 才能附加它。它不會上傳任何內容，也不會傳送訊息。對已就緒的附件再次呼叫，會照原樣傳回該附件。

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

## 輸入

| 輸入 | 類型 | 必填 | 預設值 | 作用 |
| --- | --- | --- | --- | --- |
| `attachmentId` | 字串（UUID） | 是 | — | 來自 [create_attachment_upload](https://air.build/tw/docs/mcp-tools/create_attachment_upload/) 的 `attachmentId` |

## 結果

| 欄位 | 說明 |
| --- | --- |
| `attachment.id` | 附件的 ID |
| `attachment.fileName` | 檔案名稱 |
| `attachment.mediaType` | 媒體類型，小寫 |
| `attachment.byteCount` | 大小，以位元組為單位 |
| `attachment.status` | `ready` |
| `attachment.altText` | 為看不到圖片的人提供的圖片說明，或 `null`（這個工具不會設定） |

```json
{
  "attachment": {
    "id": "00000000-0000-0000-0000-000000000000",
    "fileName": "report.pdf",
    "mediaType": "application/pdf",
    "byteCount": 482113,
    "status": "ready",
    "altText": null
  }
}
```

## 錯誤

| 訊息 | 何時出現 | 處理方式 |
| --- | --- | --- |
| The completed object does not match the Attachment upload declaration. | 上傳檔案的大小或 `Content-Type` 與宣告的不同，或位元組傳到了另一個上傳 | 該附件會被捨棄：請用 [create_attachment_upload](https://air.build/tw/docs/mcp-tools/create_attachment_upload/) 重新開始，並以提供的 `contentType` 傳送與 `byteCount` 完全相同的位元組 |
| The Attachment upload state cannot be completed. | 該上傳已無法完成 | 用 [create_attachment_upload](https://air.build/tw/docs/mcp-tools/create_attachment_upload/) 重新開始 |
| The Attachment upload state changed before it became ready. | 在這次呼叫檢查期間，另一次呼叫變更了該上傳 | 再次呼叫；如果仍然失敗，請開始新的上傳 |
| Attachment not found. | 沒有附件使用這個 ID，或它已被捨棄 | 使用來自 [create_attachment_upload](https://air.build/tw/docs/mcp-tools/create_attachment_upload/) 的 `attachmentId` |
| Team not found. | 該附件屬於你不在其中的團隊 | 使用你所屬團隊的附件 |
| File uploads aren't available right now. Try again later. | 目前無法上傳。 | 稍後再試 |

如果位元組從未上傳，AirBuild 會找不到它們，呼叫會以儲存空間錯誤失敗：請先完成 `PUT`。所有工具都可能傳回的錯誤，請參閱 [伺服器與登入](https://air.build/tw/docs/mcp-tools/server/#errors)。

## 範例

```json
{"name": "complete_attachment_upload", "arguments": {"attachmentId": "00000000-0000-0000-0000-000000000000"}}
```
