Upload Asset
upload_assetUpload a binary asset (image, font, audio, …) to the project's hosted storage. This uploads bytes you actually hold — a file you generated, downloaded, or read yourself. Chat attachments don't qualify: the user's attachments never reach MCP servers (you see attached images through vision only; there is no file, id, or URL behind them you can read), so for those use request_user_upload instead and the user re-picks the file in a card that uploads from their browser. Three modes. ChatGPT conversation files — a generated image, a file ChatGPT itself holds: pass the file as the file parameter and the host attaches a download link itself; this server fetches the bytes directly, at full quality (nothing goes through your sandbox or through base64 in arguments; content_type and size_bytes are optional here). Never downscale or re-encode a generated image to fit the inline cap — pass it as file instead. Files up to 3 MB you hold yourself — pass content_base64 plus size_bytes (the decoded byte count) and the upload completes in this call, returning publicUrl. Larger files — pass size_bytes alone to get an uploadUrl; PUT the raw bytes to it with the same content_type and exact byte count (e.g. curl -X PUT -H 'Content-Type: image/png' --data-binary @file.png '<uploadUrl>'), then reference publicUrl. Some sandboxes (claude.ai Cowork, ChatGPT containers) block egress to S3: if the PUT fails in any way — connection failure, proxy error, or a response without an x-amz-request-id header — that block is permanent for the session, so switch paths instead of retrying or re-encoding smaller: the file parameter in ChatGPT for any file that exists in this conversation, content_base64 for files under 3 MB, request_user_upload for user-provided files, or a PUT from inside the project VM via run_code_in_vm (re-mint the URL first; it is short-lived). For AI imagery generated fresh, use generate_image. A single file can be at most 100 MB via the presigned mode (the inline content_base64 mode is capped at 3 MB).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | No | ChatGPT only: a file from this conversation (e.g. a generated image). The ChatGPT host fills download_url/file_id when you reference the file; the values are host-issued and cannot be constructed by hand — on clients without file-parameter support, leave this unset and use the other modes. | |
| file_name | Yes | ||
| projectId | Yes | ||
| size_bytes | No | Required unless `file` is set. Exact byte count of the file, as measured from the file itself (e.g. stat/ls -l). With content_base64 it must equal the decoded length; in presigned mode the PUT must send exactly this many bytes. | |
| content_type | No | Required unless `file` is set (in that mode the type is derived from the downloaded bytes; pass this only as a hint). | |
| content_base64 | No | The file's bytes, base64-encoded (≤3 MB decoded). When set, the upload completes in this call. |