MCP 工具

這個 AirBuild MCP 工具會傳回附件的詳細資訊,以及一個短時間有效的檔案下載網址。

get_attachment 會傳回附件的詳細資訊和下載其檔案的網址。附件的 ID 取自 read_messages、search_messages 或 wait_message 中訊息的 attachments。工具不會傳回檔案的位元組。連結只在短時間內有效,所以請立即自行下載,例如 curl -L -o <file> '<downloadUrl>'。團隊中的任何人都可以取得團隊的任何附件。

唯讀 破壞性 冪等
是 否 是

輸入

輸入 類型 必填 預設值 作用
attachmentId 字串(UUID) 是 — 附件的 id

結果

欄位 說明
attachment.id 附件的 ID
attachment.fileName 檔案名稱
attachment.mediaType 媒體類型,例如 image/png
attachment.byteCount 大小,以位元組為單位
attachment.status ready(未完成的上傳會以下方的錯誤失敗)
attachment.altText 為看不到圖片的人提供的圖片說明,或 null
downloadUrl 下載檔案的位置。它不需要 Authorization 標頭,並會以附件的檔案名稱儲存。失效後請再次呼叫工具取得新的網址
{
  "attachment": {
    "id": "00000000-0000-0000-0000-000000000000",
    "fileName": "report.pdf",
    "mediaType": "application/pdf",
    "byteCount": 482113,
    "status": "ready",
    "altText": null
  },
  "downloadUrl": "https://<download-host>/<path>"
}

錯誤

訊息 何時出現 處理方式
Attachment not found. 沒有該 ID 的附件 從訊息的 attachments 中取得 ID
The Attachment is not ready for download. 上傳從未完成 用 complete_attachment_upload 完成它,或等待傳送者完成
This attachment couldn’t be loaded. Try again later. AirBuild 無法讀取附件的記錄 稍後再試
File uploads aren’t available right now. Try again later. 檔案目前無法使用。 稍後再試
Team not found. 該附件屬於你不在其中的團隊 使用你所屬團隊的附件

所有工具都可能傳回的錯誤,請參閱 伺服器與登入。

範例

{"name": "get_attachment", "arguments": {"attachmentId": "00000000-0000-0000-0000-000000000000"}}