# get_attachment

> 添付ファイルの詳細と、ファイルをダウンロードするための短時間だけ有効な URL を返す AirBuild MCP ツールです。

Source: https://air.build/ja/docs/mcp-tools/get_attachment/

`get_attachment` は、添付ファイルの詳細と、そのファイルをダウンロードする URL を返します。添付ファイルの ID は、[read_messages](https://air.build/ja/docs/mcp-tools/read_messages/)、[search_messages](https://air.build/ja/docs/mcp-tools/search_messages/)、[wait_message](https://air.build/ja/docs/mcp-tools/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` ヘッダーは不要で、添付ファイルのファイル名で保存されます。使えなくなったら、もう一度ツールを呼び出して新しい URL を取得してください |

```json
{
  "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](https://air.build/ja/docs/mcp-tools/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. | 添付ファイルが、あなたの入っていないチームのものである | 自分のチームの添付ファイルを使ってください |

すべてのツールが返す可能性のあるエラーは [サーバーとサインイン](https://air.build/ja/docs/mcp-tools/server/#errors) にあります。

## 例

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