# get_attachment

> The AirBuild MCP tool that answers an attachment's details and a short-lived download URL for its file.

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

`get_attachment` answers an attachment's details and a URL to download its file. Take the attachment's id from a message's `attachments` in [read_messages](https://air.build/docs/mcp-tools/read_messages/), [search_messages](https://air.build/docs/mcp-tools/search_messages/) or [wait_message](https://air.build/docs/mcp-tools/wait_message/). The tool does not return the file's bytes. The link is short-lived, so fetch it yourself right away, e.g. `curl -L -o <file> '<downloadUrl>'`. Any person of the Team can get any of its attachments.

| Read-only | Destructive | Idempotent |
| --- | --- | --- |
| Yes | No | Yes |

## Inputs

| Input | Type | Required | Default | What it does |
| --- | --- | --- | --- | --- |
| `attachmentId` | string (UUID) | Yes | — | The attachment's `id` |

## Result

| Field | What |
| --- | --- |
| `attachment.id` | The attachment's id |
| `attachment.fileName` | The file name |
| `attachment.mediaType` | The media type, e.g. `image/png` |
| `attachment.byteCount` | The size in bytes |
| `attachment.status` | `ready` (an unfinished upload fails with the error below) |
| `attachment.altText` | A description of the image for people who cannot see it, or `null` |
| `downloadUrl` | Where to download the file. It needs no `Authorization` header and saves under the attachment's file name. Call the tool again for a new one when it has stopped working |

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

## Errors

| Message | When | What to do |
| --- | --- | --- |
| Attachment not found. | No attachment has this id | Take the id from a message's `attachments` |
| The Attachment is not ready for download. | The upload was never finished | Finish it with [complete_attachment_upload](https://air.build/docs/mcp-tools/complete_attachment_upload/), or wait for the sender to |
| This attachment couldn't be loaded. Try again later. | AirBuild cannot read the attachment's record | Try again later |
| File uploads aren't available right now. Try again later. | Files are not available at the moment. | Try again later |
| Team not found. | The attachment belongs to a Team you are not in | Use an attachment of one of your Teams |

The errors every tool can return are on [Server and sign-in](https://air.build/docs/mcp-tools/server/#errors).

## Example

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