Skip to main content
Glama

gemini_upload_file

Upload an image, video, or audio file to Gemini Files API once and receive a reusable file_uri to attach to multiple generations without re-uploading.

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).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlNoPublic https URL the SERVER downloads and uploads (image/video/audio, up to 100MB). No bytes pass through the conversation.
pathNoPath to a local file (absolute, or resolved against $GEMINI_INPUT_DIR). Confirm-gated like every other local-file input.
r2_keyNoUnavailable on this server (media is written to local disk) — pass the file path via `path` instead.
confirmNoMust be true to proceed. Without this, the tool returns a preview.
mime_typeNoOverride the detected MIME type (sniffed from the bytes / taken from the server response otherwise)
data_base64NoRaw base64 or a data: URI. Last resort — this is the one form that costs model context (~14k tokens for a modest JPEG).
display_nameNoHuman-readable name recorded against the upload
Behavior4/5

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

Annotations indicate readOnlyHint=false and openWorldHint=true, aligning with the write operation described. The description adds behavioral details: 'upload once,' reusability, and token cost of data_base64. It does not contradict annotations.

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?

The description is front-loaded with the main purpose and keywords. It is slightly long but every sentence adds value, covering usage, parameters, and behavioral notes. Minor redundancy (e.g., 'reuse across calls' repeated) but overall efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema, the description clearly states the return value (file_uri as files/<id>). It covers input sources and expiration. Missing details on error handling or size limits (except in url param), but for a file upload, this is sufficient.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, but the description adds significant value: it explains that exactly one of url, data_base64, or path must be provided, clarifies the confirm parameter's requirement, and warns about token cost for data_base64. This goes well beyond the schema's descriptions.

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?

The description clearly states the tool uploads a file to the Gemini Files API and returns a reusable file_uri. It lists supported file types (image, video, audio clip) and distinguishes from siblings like gemini_list_files or gemini_image_generate by focusing on upload-only functionality.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit use cases: upload files to avoid base64 tokens and for reusability across calls. It mentions expiration (~48h) but does not explicitly state when not to use this tool or name alternative tools. However, the sibling context shows no direct upload alternative, so the guidance is adequate.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/chrischall/gemini-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server