Skip to main content
Glama

Add media from a URL

wp_upload_media_from_url
Destructive

Download a file from a public URL and add it to the WordPress media library as a new attachment, with optional title, alt text and post attachment.

Instructions

Download a file from a public http(s) URL and add it to the media library; the file is public under its new URL afterwards, and each call adds a new file. The site fetches the file itself through WordPress' safe-URL check, repeated on every redirect: private and internal hosts are refused unless WordPress allows them (such as the site's own host); at most 3 redirects, 20 seconds per request, 20 MB by default (filter ab_mcp_upload_max_bytes). The URL or the content type must name JPEG, PNG, GIF, WebP or PDF; HTML, SVG, XML and script responses are refused, and WordPress then checks the file as for any upload. No third-party API is involved. Returns {uploaded: true, id, url}. Needs upload_files, and the right to edit post_id when given. File content at hand is uploaded as base64 with wp_upload_media.

Input Schema

NameRequiredDescriptionDefault
altNoAlternative text for an image, stored as plain text.
urlYesPublic http(s) URL of the file. Your site downloads it; nothing is sent anywhere else.
titleNoTitle of the new attachment.
post_idNoId of a post to attach the file to; needs the right to edit that post. Default: attached to no post.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv4.7.0

TDQS

A4.8/5.0
Behavior5/5

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

Goes well beyond the annotations: discloses safe-URL checking on every redirect, 3-redirect cap, 20s timeout, 20 MB limit with the filter name ab_mcp_upload_max_bytes, allowed MIME set, that each call adds a new file, and that the result becomes public. Also states required capabilities (upload_files, edit right on post_id) and the return shape.

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-loaded with the action, then behavior, then requirements, then return value, and every clause carries information (limits, MIME set, permissions). It is dense and runs as one long sentence chain, which slightly hurts scannability, but no sentence is redundant.

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 no output schema, the description supplies the return object {uploaded, id, url}; with a mutation tool it supplies failure modes, limits, and permission prerequisites. An agent has everything needed to invoke and predict outcomes.

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 adds real meaning by tying post_id to an edit-permission requirement and constraining url to public http(s) that the site fetches itself. It adds little on alt/title beyond the schema, so not a 5.

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 + resource ('download a file from a public http(s) URL and add it to the media library') and explicitly differentiates from the sibling wp_upload_media at the end. An agent can decide between URL-based and base64 uploads without opening either 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?

Names the alternative (wp_upload_media) and the exact condition that selects it ('file content at hand'), and implies this tool for remote files. The exclusion of private/internal hosts and of HTML/SVG/XML/script content further bounds when calls will fail.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools