Skip to main content
Glama

Upload a file (path or base64) to Replicate

replicate_upload_file

Upload a file to Replicate storage by absolute local path or base64 data and receive a temporary URL (valid ~24h) to use as model input.

Instructions

Upload a file to Replicate's file storage and get back a URL valid for ~24 hours. Pass the returned URL as a model input (e.g. image for upscale/inpaint/vision, image_url for video, reference_audio_url for voice clone).

Two input modes — provide EXACTLY ONE:

  • file_path: absolute local path of a file on the machine running the server.

  • base64_data: the file's bytes as base64 (a bare base64 string OR a full "data:;base64,..." URI). Use this when you hold bytes in memory but have no local path — e.g. an image a user dropped into the chat that a code container can read and base64-encode. NOTE: an MCP client (Claude Desktop) generally cannot reproduce a large dragged-in image's exact bytes as a tool argument — base64 mode is for callers that genuinely have the bytes (web container, programmatic clients).

Args:

  • file_path (string, optional): Absolute local path. Provide this OR base64_data.

  • base64_data (string, optional): base64 contents or data: URI. Provide this OR file_path.

  • mime_type (string, optional): MIME override (e.g. 'image/png'). Auto-detected from the path extension or a data: URI; defaults to application/octet-stream for raw base64.

  • file_name (string, optional): Name for a base64 upload.

Returns structuredContent: { url, file_id, name }

  • url: Replicate-hosted URL (~24h expiry) — pass this as a model input.

Examples:

  • file_path="C:/Users/me/photo.png"

  • base64_data="data:image/png;base64,iVBORw0KG...", → uploads, returns URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_nameNoOptional name for a base64 upload. Ignored when file_path is used (the basename is taken from the path).
file_pathNoAbsolute local path of the file to upload. Provide either this OR base64_data.
mime_typeNoMIME type override (e.g. 'image/png'). Auto-detected from file extension (file_path) or the data URI; defaults to application/octet-stream for raw base64.
base64_dataNoFile contents as base64 (a bare base64 string or a full 'data:<mime>;base64,...' URI). Use this when you have bytes in memory but no local path — e.g. a code container that read a chat-uploaded image. Provide either this OR file_path.
Behavior5/5

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

With no annotations providing hints, the description fully covers behavioral traits: the file upload operation, the ~24-hour URL expiry, the two input modes and their constraints, and limitations of base64 mode for certain clients. No contradictions with annotations are present.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections, bullet points, and examples. Every sentence adds value, and key information is front-loaded. It is appropriately sized for a tool with multiple modes and parameters.

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?

Given no output schema, the description adequately explains the return format (structuredContent with url, file_id, name) and the URL expiry. It covers all necessary details for an agent to select and invoke the tool correctly, including examples.

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?

The schema provides 100% parameter coverage with descriptions. The description adds further meaning: explains exclusivity of file_path and base64_data, auto-detection of mime_type, and the behavior of file_name. It clarifies edge cases and usage patterns beyond the schema.

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 specific verb and resource: 'upload a file to Replicate's file storage and get back a URL'. It distinguishes this tool from its siblings, which are about predictions, models, and other operations.

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 explains when to use file_path vs base64_data, and notes that base64 is for callers with bytes in memory. It provides examples and clarifies the returned URL's usage. However, it lacks explicit when-not-to-use guidance or alternatives, though contextually it is clear.

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/sena-labs/replicate-mcp-server'

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