Skip to main content
Glama

Upload a file

upload_media
Destructive

Uploads one file to a WhatsApp number’s media library and returns its media id (med_…), which a message, the number’s profile picture or the AI assistant’s knowledge then takes. The file travels inline as data_base64 with its mime_type, and goes to Meta and to Cosend’s storage in one call. Through an AI app a file is up to 5 MB; a larger video, audio file or document is uploaded in the Cosend dashboard. mime_type decides how WhatsApp sends it: image (jpeg, png), video (mp4, 3gpp), audio (aac, amr, mpeg, mp4, ogg), document (pdf, plain text, Word, Excel and PowerPoint) or sticker (webp). A type WhatsApp does not take, or a file over the limit, is refused before anything is stored. Every upload is its own file on that number, even with the same bytes. The file waits in the media library until a message, the profile or the assistant’s knowledge uses it.

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": {
      "connection_id": "<connection_id>",
      "mime_type": "<mime_type>",
      "data_base64": "<data_base64>"
    },
    "name": "upload_media"
  }
}

Input Schema

NameRequiredDescriptionDefault
filenameNo
mime_typeYesOne of the types WhatsApp accepts, which also decides how the file is sent: image (image/jpeg, image/png; 5 MB), video (video/mp4, video/3gpp; 16 MB), audio (audio/aac, audio/amr, audio/mpeg, audio/mp4, audio/ogg; 16 MB), document (application/pdf, text/plain and the Word, Excel and PowerPoint types; 100 MB), sticker (image/webp; 100 KB static, 500 KB animated). Any other type, or a file over its limit, is refused before anything is stored.
data_base64Yes
connection_idYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4/5.0
Behavior4/5

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

Annotations already flag a non-idempotent, non-read-only, destructive operation, and the description reinforces this with 'Every upload is its own file on that number, even with the same bytes.' It also adds genuinely new behavior: the file is written to both Meta and Cosend storage in one call, invalid types or oversize files are refused before anything is stored, and the file persists in the library until consumed.

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

Conciseness3/5

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

The return value and the inline-upload mechanics are front-loaded, which is good, but the long mime-type enumeration and per-type size table duplicate the schema description almost verbatim. The closing sentence about the file waiting in the media library repeats an idea already implied earlier, so some sentences do not fully earn their place.

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

Completeness4/5

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

With no output schema, the description correctly supplies the return value (media id format) and how it is consumed. It covers size limits, accepted types, validation-before-storage behavior and the dashboard fallback path. Remaining gaps are the filename and connection_id parameters and any error/response shape detail beyond the refusal case.

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

Parameters3/5

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

With only 25% schema description coverage, the description must carry more weight, and it partially does by explaining that the file travels inline as data_base64 alongside mime_type and that mime_type decides how WhatsApp sends the file. However, most of the mime_type detail merely restates the schema, and neither filename nor connection_id receives any explanation, leaving two of four parameters undocumented anywhere.

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 ('Uploads one file to a WhatsApp number's media library') and names the return value ('returns its media id (med_…)'), plus what consumes that id. This clearly separates it from get_media (retrieval) and send_message (delivery) among the siblings.

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?

Gives concrete when-to-use context: it is the step before a message, profile picture or assistant knowledge uses the file, and files over 5 MB through an AI app must instead be uploaded in the Cosend dashboard. It never names a sibling tool as an alternative, so the routing guidance is contextual rather than explicit.

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