Skip to main content
Glama

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

NameRequiredDescriptionDefault
altNoAlt text (for a stock photo, defaults to the provider's description)
urlNoPublic http(s) URL of the file itself (not a web page showing it)
siteNoSite 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.
filenameNoDisplay name in the media library, e.g. 'hero.jpg' (url and base64 only; a stock photo is named by the provider)
dataBase64NoThe file's bytes, base64-encoded (a data: URL prefix is accepted)
stockImageIdNoA photo id from search_stock_images; the image is downloaded from the stock provider.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.1.7
    • changedInput schema / properties / alt / description
      Previous value: -"Alt text"New value: +"Alt text (for a stock photo, defaults to the provider's description)"
    • changedInput schema / properties / filename / description
      Previous value: -"Display name in the media library, e.g. 'hero.jpg'"New value: +"Display name in the media library, e.g. 'hero.jpg' (url and base64 only; a stock photo is named by the provider)"
    • addedInput schema / properties / stockImageId
      Added value: +{
      +  "description": "A photo id from search_stock_images; the image is downloaded from the stock provider.",
      +  "maxLength": 200,
      +  "minLength": 1,
      +  "type": "string"
      +}
  2. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations cover the safety profile (not read-only, open-world, non-idempotent, non-destructive), and the description adds substantial context beyond them: the 5 MB cap, per-redirect-hop refusal of private-network addresses, download cutoff behavior, the always-new-asset semantic, and the content.create permission with role scoping for Authors.

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?

Purpose and source constraints are front-loaded, and each sentence carries operational weight (limits, permissions, cost, alternatives). It runs long as a single dense block, so structure could be improved, but there is little wasted text.

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 multi-source upload tool with no output schema, the description covers the return value's use ('set its documentId on an image field with set_field'), the permission requirement, size and network constraints, and sibling alternatives. An agent has everything needed to invoke it correctly.

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, but the description adds real meaning the schema doesn't: the three sources are mutually exclusive ('from exactly one source'), the URL must be publicly reachable, and stock photos are stored with their attribution. It stops short of documenting the site/filename interplay more fully.

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 precise verb+resource ('Add a file ... to the media library') and immediately scopes the three allowed sources, distinguishing it from siblings like create_upload_link, search_stock_images, and list_assets. An agent can identify the operation and its boundaries without opening the 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?

Explicitly routes the agent: use create_upload_link for local files, list_assets to reuse an existing asset, set_field to attach the returned documentId, and search_stock_images as the source of stockImageId. It also names when-not (a new asset is always created). Nothing is left to inference.

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