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"}}