upload_asset
Add a file (PNG, JPEG, GIF, WEBP or PDF, max 5 MB) to the media library from exactly one source: a public URL, base64 bytes, or a stock photo id from search_stock_images (stored with its attribution).
Instructions
Add a file (PNG, JPEG, GIF, WEBP or PDF, max 5 MB) to the media library from exactly one source: a public URL, base64 bytes, or a stock photo id from search_stock_images (stored with its attribution). Returns the new asset — set its documentId on an image field with set_field. Each call stores a NEW asset, even for a file already in the library (reuse one via list_assets). A URL must be publicly reachable: private-network addresses are refused at every redirect hop, and a download over 5 MB is cut off with an error. For files on YOUR machine prefer create_upload_link: base64 through a tool call costs roughly 1 token per 2-3 bytes. Requires the content.create permission (Admin, Editor, Author — an Author only within their own sections).
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_asset"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| alt | No | Alt text (for a stock photo, defaults to the provider's description) | |
| url | No | Public http(s) URL of the file itself (not a web page showing it) | |
| site | No | Site slug or id to act in (multisite). Omit to use this server's default site. Call list_sites to see what exists — an empty tree or search usually means the wrong site, not missing content. | |
| filename | No | Display name in the media library, e.g. 'hero.jpg' (url and base64 only; a stock photo is named by the provider) | |
| dataBase64 | No | The file's bytes, base64-encoded (a data: URL prefix is accepted) | |
| stockImageId | No | A photo id from search_stock_images; the image is downloaded from the stock provider. |