Skip to main content
Glama

Get an attachment download link

get_attachment_file
Read-only

Get temporary download URLs for attachments by media_id from list_attachments (or the id in a /media/ URL). Pass one ID as a string, or a list of 1–100 IDs. A string returns one download; a list returns results, even with one item. Duplicate IDs appear once, in input order. Each result has the download fields or media_id and error; an unavailable or inaccessible attachment does not block the others. Call only for the files the user requests. The URL downloads the original bytes without an Authorization header or browser session. Anyone holding the URL can download that file until expires_at; do not publish it or include it in shared documents. Request a new URL if it expires. No OAuth bearer is exposed. Only accessible, stored media is available. This returns a download URL, not a ChatGPT file_id; another tool must support fetching the URL to use or transfer the file.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "media_id": "<media_id>"
    },
    "name": "get_attachment_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
media_idYesOne media_id from list_attachments (or a /media/<id> URL), or a list of 1–100 IDs. A list returns results per distinct ID in input order.

Output Schema

NameRequiredDescriptionDefault
urlNoTemporary URL for the original file. GET without Authorization or cookies. Grants anyone holding it access to this file until expires_at; do not publish it.
resultsNoList input only: one download or error per distinct media_id, in input order.
media_idNoThe requested attachment's id.
file_nameNoThe original file name.
expires_atNoUTC expiry in ISO 8601; request a new link after this.
size_bytesNoThe file size in bytes.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the read-only, non-destructive annotations, it discloses genuinely non-obvious traits: the URL grants unauthenticated access to anyone holding it, expires at expires_at, requires re-requesting, and does not expose an OAuth bearer. It also explains partial-failure behavior (one unavailable attachment does not block others) and deduplication of repeated IDs.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Content is front-loaded with the core action and input shape, then escalates to semantics and security. It is dense but mostly earns its words; the security warning is stated twice in slightly different forms ('do not publish it or include it in shared documents' and 'Anyone holding the URL can download that file'), which is mild redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, yet the description still sketches the result shape (download fields or media_id plus error) and covers failure isolation, expiry, auth model, and ID sourcing. For a single-parameter read tool, nothing an agent needs in order to call it correctly or safely is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline would be 3, but the description adds real meaning beyond the schema: a bare string returns a single download whereas a list returns a results collection even for one item, and duplicate IDs collapse into one result in input order. Only minor formatting details of the response per item are left implicit.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb and resource: 'Get temporary download URLs for attachments by media_id,' and immediately names where the ID comes from (list_attachments or a /media/<id> URL). It also explicitly distinguishes itself from send_file-class siblings by stating it 'returns a download URL, not a ChatGPT file_id.'

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives a clear usage constraint ('Call only for the files the user requests') and scopes eligibility to accessible, stored media. It also warns that another tool is needed to actually fetch or transfer the file, which effectively signals this is not the fetch tool, though it never names that alternative explicitly.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources