Attach an uploaded file
attach_mediaSave 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
| Name | Required | Description | Default |
|---|---|---|---|
| fit | No | cover = crop to fill (default), contain = fit + pad | |
| crop | No | How a 'cover' crop chooses what to keep: 'smart' = saliency-based, keeps the subject (default); 'centre' = predictable middle crop, better for posters/screenshots | |
| format | No | Reformat to this before saving; omit to keep original | |
| storageKey | Yes | The storageKey returned by create_media_upload | |
| workspaceId | No | Which 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
| Name | Required | Description | Default |
|---|---|---|---|
| ok | No | ||
| note | No | ||
| media | No |