royal-mcp__wp_upload_media
Upload a file to the media library. Accepts images and any document type the site allows in its media library (for example PDF). Send the file one of two ways: as file, a file the user attached or generated in the chat (clients that support file parameters, such as ChatGPT, fill this in), or as content_base64 with filename when you have the raw bytes. For files already hosted at a public link, prefer wp_upload_media_from_url. Only files that are part of the conversation (attached, or made by an image generator) come with a download link: a file created or edited in a code sandbox (a path like /mnt/data/...) has none, so ask the user to attach that file to the chat first, or upload the original instead. To convert, resize or compress an image on the way in (for example a JPEG under 400 KB), pass convert_to, max_width / max_height and max_kb here rather than editing the image in a code sandbox first: the site does the work, and the original generated or attached file keeps its download link. Pass if_exis… Through Royally: waits for a person to approve it in Royally; nothing on the site changes until then.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | No | A file from the conversation. The client supplies a short-lived download link; the site fetches it once. | |
| title | No | ||
| max_kb | No | Images only. Lower the quality step by step until the file is at most this many kilobytes. Works best with convert_to jpeg or webp. | |
| caption | No | ||
| quality | No | Images only. Starting quality for JPEG or WebP (default 82). | |
| site_id | No | Site to run this tool on: 8ef2e52b-bd07-4671-a363-ebe8b480b65c (https://demo.royalplugins.com) | |
| alt_text | No | Alt text (images only) | |
| filename | No | Filename with extension (e.g. hero.jpg, report.pdf). Required with content_base64; optional with file. | |
| if_exists | No | reuse: when the same file (for a URL upload, the same URL) was already uploaded with the same image options, return that attachment instead of adding a duplicate. Default create. | |
| max_width | No | Images only. Scale down to at most this many pixels wide, keeping proportions (never scales up). | |
| convert_to | No | Images only. Save the image in this format; a PNG from an image generator usually becomes a much smaller JPEG. | |
| max_height | No | Images only. Scale down to at most this many pixels high, keeping proportions (never scales up). | |
| content_base64 | No | Base64-encoded file bytes. Use this or file, not both. The bytes travel inside your own reply, so this suits small files only (roughly under 40 KB before encoding); for larger files use file or wp_upload_media_from_url. |