Skip to main content
Glama

Import external asset

var2_upload_asset

Upload a file the user ATTACHED to the chat (a photo from their phone, "my logo as a PNG", a voice memo) when NO link exists for it yet. If the message already contains a link or placeholder_id for the file, this tool is WRONG — a www.var2.ai / api.var2.ai / .supabase.co link is already inside var2; hand it to the matching create/modify/get tool. Sole pasted-link exception: NON-var2 link + explicit "import / pull it into var2". Text-only request, no file ("I want a song and cover art") → the matching create_ generator. When it IS an upload: call this FIRST, then pass the returned url verbatim as image_url / first_frame_url / reference_image_urls / audio_url / source_video_url. If your host filled in file (a native attachment object), just send it as-is — no url, no base64. Stores bytes durably in var2 storage; returns a first-party url (no expiry) + placeholder_id for var2_join_videos chaining. ≤100MB per file. base64 data: ALWAYS pass expected_bytes (+ sha256 if known) so truncation is rejected; >1.4M chars → parts via chunk_index/chunk_total/upload_id. Never pre-shrink a file to fit.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "type": "<type>"
    },
    "name": "var2_upload_asset"
  }
}

Input Schema

NameRequiredDescriptionDefault
urlNoPublic https URL of the asset to rehost/import. Must be reachable from Vercel's egress; private/loopback hostnames are rejected. Provide EITHER `url` or `data` (not both).
dataNoBase64 (or a `data:` URL) of the raw bytes — for a SMALL local file with no public URL when the client has no shell to PUT with. Hard-capped at 1MB; larger files MUST use var2_request_upload. Provide EITHER `url` or `data` (not both).
fileNoNATIVE attachment input. Hosts that support file params (ChatGPT via `_meta["openai/fileParams"]`) fill this in themselves when the user attaches a file — you do NOT construct it. The server reads its `download_url` and imports the bytes directly, so no PUT, no base64 and no browser step is involved. Hosts without file-param support never send this; use `url` or `data` there.
nameNoOptional display name. Stored in the generation row's prompt/title so it shows up cleanly in the user's asset library.
typeYesModality of the asset. The server validates the bytes (Content-Type for `url`, plus a magic-byte signature check either way) match image/* / video/* / audio/*; a mismatch rejects the upload.
sha256NoHex sha256 of the original file — verified end-to-end when provided.
upload_idNoChunk-session id. Omit on part 0 (response returns one); pass it on every later part. The final part assembles, validates and stores.
chunk_indexNoChunked upload for files whose base64 exceeds one call: slice the base64 STRING into parts (~200K chars each recommended — a part is emitted as tool-call tokens, so keep it small enough to produce reliably; 1.4M hard cap; any split point) and send one part per call in `data`. 0-based part number.
chunk_totalNoTotal parts. Required with chunk_index.
content_typeNoMIME of the inline `data` (e.g. "image/png"). Optional — the magic-byte check derives the real type regardless.
expected_bytesNoSize of the ORIGINAL file in bytes. STRONGLY recommended with `data`: a decoded-size mismatch is rejected instead of storing a truncated file.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Goes far beyond the annotations (readOnlyHint=false, openWorldHint=true, destructiveHint=false) by disclosing that bytes are stored durably in var2 storage, that the returned url is first-party with no expiry, that a placeholder_id is returned for join chaining, and that the per-file ceiling is 100MB. It also states server-side validation behavior (magic-byte check, truncation rejection via expected_bytes) and warns never to pre-shrink a file.

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?

Front-loaded with the routing decision in the first sentence, then ordered follow-on guidance (call order, return usage, size/chunk rules). It is dense but nearly every clause carries decision-relevant information; the only cost is the numeric-threshold overlap noted above, which adds parsing burden.

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?

For an 11-parameter, nested-object upload tool with no output schema, the description still covers routing, invocation order, native-attachment handling, chunked transfer, size limits, and what the response yields (url + placeholder_id). An agent has everything needed to call it correctly and to consume its result.

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

Parameters4/5

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

With 100% schema coverage the baseline is 3, and the description adds real operational meaning: send `file` as-is with no url/base64 when the host filled it natively, always pass expected_bytes (+sha256) with `data`, and split base64 via chunk_index/chunk_total/upload_id. Minor tension exists between the description's '1.4M chars → parts' threshold and the schema's 1MB hard cap on `data`, which an agent could read as conflicting limits.

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?

States a specific verb (upload/import) and a precisely scoped resource: a file the user ATTACHED to the chat when no link exists. It actively distinguishes itself from sibling behaviors (create/modify/get tools for existing var2 links, create_* generators for text-only requests), so an agent can route without opening any schema.

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

Usage Guidelines5/5

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

Gives explicit when-to-use, when-NOT-to-use ('this tool is WRONG' when a link or placeholder_id exists), one named exception (non-var2 link plus explicit 'import into var2'), and the fallback route for each exclusion. It even specifies call ordering: this tool first, then pass the returned url into the create/modify tool's field.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources