Upload asset
upload_assetPut an image into a form's storage: pass parent (the form id) and filename.
Two ways: • Small files (up to about 100 KB): pass the bytes base64-encoded as content_base64. Hard limit 2 MiB. • Anything larger: omit content_base64 and pass content_type and size_bytes. You get back a one-time upload_url; PUT the raw bytes to it with that content-type (no authorization header — the url is the permission, so keep it secret). It expires in 300 seconds, refuses more than size_bytes or a different content-type, and takes at most 26214400 bytes (25 MiB). • A file the person has but you cannot send (for example one attached in chat, when your sandbox cannot reach the upload host): pass content_type and for_person: true instead of size_bytes. You get { upload_url, expires_at, for_person: true, instructions }; give the person upload_url to open in their browser, where they choose the file (any file of that kind; for an image, a PNG, JPEG, GIF or WebP). It lasts up to 30 minutes and survives a wrong pick. When they say it is done, confirm the file exists before using it.
If the PUT to upload_url fails because the host cannot be reached (a network, proxy or allowlist error from your sandbox), either ask the person to add the upload_url's host to Settings > Capabilities > Additional allowed domains and try again, or call upload_asset again with for_person: true and hand them the link.
Confirm with the user before calling this.
Without bytes: { upload_url, method: "PUT", headers, expires_at, max_bytes, instructions }.
Forms: pass parent (the form id) and filename; images only (png, jpg/jpeg, gif, webp), the same two ways, except that a for_person link takes only the image type of filename (the form's storage signs it), so ask the person which kind of image they have and name the file to match; inline, content_type may be left out and is taken from the filename extension. Inline returns { url, name, type, size, width, height }; without bytes it returns the upload ticket above, and the PUT answers that object. Give a @media block the url, with width and height as srcWidth and srcHeight; paste the whole object into a product's images in @products.
Example: upload_asset({ parent: "12:form:5f1c…", filename: "hero.png", content_type: "image/png", size_bytes: 2489301 }) → { "upload_url": "https://…/uploads/…", … }; the PUT answers { "url": "https://…/hero.png", "width": 1600, … }
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 |
|---|---|---|---|
| parent | No | A form id, to store an image for that form. Use with filename. | |
| filename | No | With parent: the image file name, e.g. "hero.png"; its extension must match content_type. | |
| for_person | No | Without content_base64: return a link the person opens in a browser to choose and upload the file themselves, instead of a url for you to PUT to. size_bytes is not needed. | |
| size_bytes | No | The exact file size in bytes. Required without content_base64, unless for_person. | |
| content_type | No | The MIME type, e.g. "image/png". Required without content_base64. | |
| content_base64 | No | The file, base64-encoded (small files only). Omit to get an upload url instead. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hash | No | ||
| path | No | ||
| size | No | ||
| method | No | ||
| headers | No | ||
| max_bytes | No | ||
| expires_at | No | ||
| for_person | No | ||
| upload_url | No | ||
| instructions | No |