Skip to main content
Glama

Upload media

wp_upload_media
Destructive

Upload a JPEG, PNG, GIF, WebP or PDF file sent as base64 content and add it to the media library. WordPress checks the file as for any upload and creates the image sizes; the file is public under its URL afterwards, and each call adds a new file. The base64 text is limited to 8 MB, so the file to about 6 MB (less where the site sets a lower limit). Returns {uploaded: true, id, url}. Needs upload_files, and the right to edit post_id when the file is attached to it. A file already on the web is added with wp_upload_media_from_url. Forwarded by AlphaBridge Connect to the one site this connection reaches.

Input Schema

NameRequiredDescriptionDefault
altNoAlternative text for an image, stored as plain text.
titleNoTitle of the new attachment.
contentYesBase64-encoded file bytes (JPEG, PNG, GIF, WebP or PDF); a data: URI prefix is accepted.
post_idNoId of a post to attach the file to; needs the right to edit that post. Default: attached to no post.
filenameYesFile name with extension, e.g. "photo.jpg".

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • addedInput schema / properties / alt / description
      Added value: +"Alternative text for an image, stored as plain text."
    • changedInput schema / properties / content / description
      Previous value: -"Base64-encoded file bytes (JPEG, PNG, GIF, WebP or PDF)."New value: +"Base64-encoded file bytes (JPEG, PNG, GIF, WebP or PDF); a data: URI prefix is accepted."
    • changedInput schema / properties / post_id / description
      Previous value: -"Attach to this post id."New value: +"Id of a post to attach the file to; needs the right to edit that post. Default: attached to no post."
    • addedInput schema / properties / title / description
      Added value: +"Title of the new attachment."
  2. Added

TDQS

A4.9/5.0
Behavior5/5

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

The description adds substantial context beyond annotations: WordPress validates the upload, generates image sizes, makes the file public at its URL, and each call creates a new file. It also discloses the 8 MB base64 limit and the approximate 6 MB file limit, which are critical behavioral constraints.

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?

The description is information-dense and front-loaded with the core action and accepted formats. Later sentences add limits, return shape, permissions, and the sibling alternative without wasted wording.

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?

For a mutation tool with annotations and no output schema, the description covers prerequisites, side effects, size limits, return shape, and the relevant alternative. An agent has enough information to invoke it correctly without needing the output schema.

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 schema already defines all five parameters. The description still adds useful semantics such as accepted file types, the base64 size limit, and the permission implication of post_id, but it does not need to repeat every parameter detail.

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?

The description states a specific verb and resource: upload a base64-encoded image or PDF and add it to the WordPress media library. It explicitly distinguishes this tool from wp_upload_media_from_url, so an agent can route correctly among siblings.

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?

It specifies the exact use case for this tool (base64 file content) and names the alternative for files already on the web. It also states the required upload capability and the edit permission when post_id is supplied.

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