gemini_upload_file
Upload an image, video, or audio file once to get a reusable file_uri, then attach that reference to later generations without resending file bytes.
Instructions
Upload a file — an image, reference photo, picture, screenshot, video or audio clip — to the Gemini Files API ONCE, and get back a reusable file_uri (files/<id>) to attach to later image, video or music generations. Keywords: upload, upload file, upload image, upload photo, attach, reference image, reference photo, file_uri, files api, image reference, reuse across calls. Use this instead of pasting base64 into a tool call: the reference is a short string, so no image bytes ever enter the conversation, and it can be reused across many generations until it expires (~48h). Provide exactly one of url (the server downloads it), data_base64, or path (a local file). A local path is confirmed first: a confirmation prompt where the client supports one; otherwise the first call returns a preview and a confirmToken, and only a repeat call with that token proceeds (see MCP_CONFIRM_MODE).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | Public https URL the SERVER downloads and uploads (image/video/audio, up to 100MB). No bytes pass through the conversation. | |
| path | No | Path to a local file (absolute, or resolved against $GEMINI_INPUT_DIR). Confirm-gated like every other local-file input. | |
| r2_key | No | Unavailable on this server (media is written to local disk) — pass the file path via `path` instead. | |
| mime_type | No | Override the detected MIME type (sniffed from the bytes / taken from the server response otherwise) | |
| data_base64 | No | Raw base64 or a data: URI. Last resort — this is the one form that costs model context (~14k tokens for a modest JPEG). | |
| confirmToken | No | ONLY for the two-step confirmation fallback (a client without MCP elicitation). The confirmToken from this same tool's phase-1 "confirmation-required" response, passed back ONLY after the user has seen that preview and explicitly approved it in chat — never on the first call, never invented, never reused. Call again with the same arguments. Ignored when the client supports elicitation. | |
| display_name | No | Human-readable name recorded against the upload |