Skip to main content
Glama

fetch_media

Read-onlyIdempotent

Download a generated media file (video, frame) and return its bytes, base64-encoded, so the file can be saved or shown even though the media endpoint isn't publicly reachable with your MCP key.

THIS IS THE EXPENSIVE PATH — prefer `download_url` from the job result. Bytes returned
here travel as TEXT, and text is where context dies: a 480 KB audio stem is ~640 thousand
base64 characters, roughly 160 000 tokens, in ONE tool result. The same file behind
`download_url` costs about twenty. An inline image preview is cheap by comparison (it
travels as an image, ~450 tokens) — it is base64 in a text field that hurts.

Because of that this tool REFUSES big files by default and hands back a download link
instead. Pass force_bytes=True only when you genuinely need the bytes inside the
conversation and know what it costs.

path: the `download_path` / `first_frame_path` / `last_frame_path` value from a job
result (e.g. "/v1/media/<id>.mp4"), or just the bare filename.
max_kb: size ceiling for an in-band answer (default 64 KB ≈ 21 000 tokens).

Returns {"filename", "media_type", "base64"}. The download is scoped to your own
account group — you can only fetch media your key produced. Note videos can be
several MB, so the base64 payload is large; fetch only when you actually need the
bytes (to save/display), not to check status (use check_job for that).

On storage: the server keeps a local cache of results and, when it runs short of disk,
drops the OLDEST files first, whether fetched or not. A dropped file is fetched back
from the Google account that made it on the next request; if that takes a while you get
`retry_after_s` — call again then. If that account is disconnected, the error names it
and gives `reconnect_url`: tell the user to reconnect it, then retry. Only when the
original cannot be fetched back does it answer 410 with the date. Saving the bytes
locally is still the way to keep something for good.

Input Schema

NameRequiredDescriptionDefault
pathYes
max_kbNo
force_bytesNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.9/5.0
Behavior5/5

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

Annotations only mark it read-only/idempotent; the description adds substantial behavior: default refusal of large files, token-cost math for base64 text vs. image, account-group scoping, disk-cache eviction order, `retry_after_s` retry semantics, `reconnect_url` on disconnect, and the 410 fallback. This is far beyond what the annotations convey.

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?

Purpose and the 'expensive path' warning are front-loaded, which is correct. It is long and somewhat repetitive (the 'text/context dies' cost point is made twice), but the storage/error paragraph earns its place for a tool with this much failure surface.

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?

No output schema exists, so the description supplies the return shape `{"filename", "media_type", "base64"}` and documents the failure modes (size refusal, retry_after_s, reconnect_url, 410). An agent has everything needed to call and recover correctly.

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

Parameters5/5

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

Schema description coverage is 0%, so the description must carry all parameter meaning — and it does: `path` (which job-result field it comes from, example format, bare filename allowed), `max_kb` (ceiling plus its default and token equivalent), and `force_bytes` (when to set it and its cost). Full compensation.

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?

States a specific verb (download) and resource (generated media file, video/frame) and the return shape (base64 bytes), and explicitly contrasts itself with `download_url` and `check_job`. An agent can tell exactly what this is without opening the schema.

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

Usage Guidelines5/5

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

Explicit when-to-use and when-not: prefer `download_url` as the cheap path, pass `force_bytes=True` only when the bytes are genuinely needed in-conversation, and use `check_job` rather than this tool to poll status. Alternatives and exclusions are all named.

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.