Skip to main content
Glama

Attach an uploaded file

attach_media
Destructive

Save an already-uploaded object (from create_media_upload) to the media library and return a media id. Works for images and videos (mp4/mov/webm). Images can optionally be reformatted to a publishing format first: the server reads the upload back from storage, stores the reformatted image as a new file and deletes the raw upload at storageKey, which cannot be undone. Videos are always recorded as-is. Omit format (or use "original") to record it unchanged — recording as-is deletes nothing. Pass the SAME workspaceId you gave create_media_upload — a storage key belongs to the workspace it was minted in and is refused anywhere else.

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": {
      "storageKey": "<storageKey>"
    },
    "name": "attach_media"
  }
}

Input Schema

NameRequiredDescriptionDefault
fitNocover = crop to fill (default), contain = fit + pad
cropNoHow a 'cover' crop chooses what to keep: 'smart' = saliency-based, keeps the subject (default); 'centre' = predictable middle crop, better for posters/screenshots
formatNoReformat to this before saving; omit to keep original
storageKeyYesThe storageKey returned by create_media_upload
workspaceIdNoWhich workspace to act in — an id from list_workspaces. Optional with a single workspace; REQUIRED once there are several, where guessing would mean posting one client's content to another client's accounts. Ask the user which one before publishing.

Output Schema

NameRequiredDescriptionDefault
okNo
noteNo
mediaNo

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?

Goes well past destructiveHint=true by pinpointing exactly what is destroyed and when: the raw upload at storageKey is deleted only when an image is reformatted, cannot be undone, and recording as-is deletes nothing. It also discloses the workspace-scoping refusal behavior, which no annotation conveys.

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?

Front-loads the core action in sentence one, then layers destructive-behavior and scoping details; every sentence carries information. Slightly dense with em-dash-joined clauses, but nothing is filler.

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?

A mutation tool with an output schema and destructiveHint=true, and the description covers the gaps that matter: exact destruction semantics, video vs image handling, and workspace binding. Combined with the schema's enum docs and the declared return id, an agent has everything needed to call it correctly.

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 is 3; the description still adds real meaning by explaining that format applies only to images (videos are always as-is) and that workspaceId must be the same value used at upload time. It does not add anything for fit/crop, which the schema already handles.

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 and resource ('Save an already-uploaded object ... to the media library and return a media id') and immediately ties it to the create_media_upload sibling as its prerequisite, which separates it from upload_media/create_variants. No ambiguity about which step of the media pipeline this is.

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?

Clear sequencing guidance ('from create_media_upload'), an explicit opt-out path ('Omit format (or use "original") to record it unchanged'), and a hard prerequisite for workspaceId in multi-workspace setups with the instruction to ask the user. It never names an alternative sibling to use instead, which keeps it just short of a 5.

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.