Skip to main content
Glama

Attach a picture, video or PDF

upload_media

Attach an image, video or PDF and get a media_id for create_post. Sources: file (an attachment from this conversation, as the host provides it), a public https url, base64 data with mime_type. Instagram, TikTok, YouTube and Pinterest need media; a PDF becomes a LinkedIn document post. When an attached file cannot be provided from here, create the post with media_pending: true instead and the person adds it in the approval card. Formats and caps: https://xpost.to/docs/api#media.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "upload_media"
  }
}

Input Schema

NameRequiredDescriptionDefault
urlNoPublic https URL
dataNoThe bytes of a small image, video or PDF generated here, base64-encoded, with `mime_type`. A file the user attached travels as `file`, or through the post's `upload_url`, not here.
fileNoA file the user attached to this conversation, as the host hands it over. Absent when the host has no such object.
alt_textNoImages: accessibility alt text (max 1000 chars). Applied natively on X and Bluesky
mime_typeNoMIME type for `data`, e.g. image/png, video/mp4
cover_media_idNoVideos: a picture's `media_id` (upload the picture first) to use as the cover instead of a frame. One or the other, not both. Facebook, and YouTube on a verified channel, show it; Instagram, TikTok, LinkedIn and Pinterest are sent it but may use their own frame.
thumbnail_timestamp_msNoVideos: cover-frame time in ms into the video

Output Schema

NameRequiredDescriptionDefault
idNoPass in create_post's media_ids.
okNoPresent and false only on a refusal.
kindNo
errorNoWhat was refused, in a sentence, when `ok` is false.
retriableNoFalse when asking again cannot change the answer.
error_codeNoMachine reason for a refusal.
people_tagsNo
replaced_byNoThe id the post has now, when you asked with one an edit retired. An edit gives a post a new id: get_delivery_receipt and get_post_metrics answer for this current version (and `asked_for` is the id you sent); update_post and delete_post refuse with error_code `replaced`. Use this id from here on.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / cover_media_id
      Added value: +{
      +  "description": "Videos: a picture's `media_id` (upload the picture first) to use as the cover instead of a frame. One or the other, not both. Facebook, and YouTube on a verified channel, show it; Instagram, TikTok, LinkedIn and Pinterest are sent it but may use their own frame.",
      +  "type": "string"
      +}
  2. Changed1 schema field changed
    • changedOutput schema / properties / replaced_by / description
      Previous value: -"With error_code `replaced`: the id the post has now. An edit gives a post a new id; use this one."New value: +"The id the post has now, when you asked with one an edit retired. An edit gives a post a new id: get_delivery_receipt and get_post_metrics answer for this current version (and `asked_for` is the id you sent); update_post and delete_post refuse with error_code `replaced`. Use this id from here on."
  3. Changed1 schema field changed
    • addedOutput schema / properties / replaced_by
      Added value: +{
      +  "description": "With error_code `replaced`: the id the post has now. An edit gives a post a new id; use this one.",
      +  "type": "string"
      +}
  4. First observed

TDQS

A4.7/5.0
Behavior4/5

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

Annotations already carry the safety profile (readOnlyHint false, openWorldHint true, idempotentHint false, destructiveHint false), and the description adds real context beyond them: the tool fetches a public URL, returns an id consumed downstream, and has a documented fallback when the host cannot supply the attachment. It stops short of stating size caps inline, deferring formats and limits to an external docs URL, and says nothing about what happens on repeat uploads.

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

Conciseness5/5

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

Front-loaded with the action and result, then sources, then platform requirements, then the fallback. Every sentence carries a distinct fact; caps are handled with a link rather than an enumeration, which keeps it tight without bloat.

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?

With an output schema present the description needn't document the return shape, and it still states the key output (`media_id`). For a 7-parameter nested-schema tool it covers sourcing, platform prerequisites, video cover rules by platform, and the failure path, leaving only external format/cap tables to the linked docs.

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 baseline is 3, but the description adds relational meaning the schema only implies: file/url/data are alternative sources rather than complements, `data` must be paired with `mime_type`, and `cover_media_id` requires uploading the picture first. It does not clarify priority when more than one source is supplied.

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?

Specific verb and resource ("Attach an image, video or PDF") plus the concrete outcome ("get a `media_id` for create_post"), which also names the sibling consumer of that id. An agent can distinguish this from create_post and update_post without opening any 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?

States the accepted sources (file, public https url, base64 data with mime_type), which platforms require media, the PDF→LinkedIn document case, and an explicit alternative path when a file can't be provided here (create the post with `media_pending: true`). That is a genuine when-to-use / when-not-to-use split rather than implied guidance.

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.