Skip to main content
Glama

upload_file

Upload a file to the workspace CDN — ONLY for callers that can run shell commands / send HTTP requests themselves .

    If you are not capable of sending HTTP requests to an endpoint,
    call ``upload_file_widget`` instead and ask the user to drop the file into the panel.
    Two modes, keyed on ``base64_content``:

    - ``base64_content`` OMITTED → **presigned** (preferred, any size): returns
      ``{"upload_url", "cdn_url", "storage_path", "content_type", "expires_in"}``.
      PUT the bytes to ``upload_url`` (sending ``Content-Type: <content_type>``
      when provided), then reference ``cdn_url`` from other tools. Bytes stream
      client → S3; nothing goes through the model. NOTE: ``cdn_url`` is dead
      until your PUT completes — never pass it to other tools before then.
      This is the path the upload widget drives. If you cannot send HTTP
      requests or the endpoint is blocked, call ``upload_file_widget`` instead.
    - ``base64_content`` GIVEN → **inline** (tiny blobs only, <= ~1.5 MB):
      decode + upload in one call. ONLY pass bytes you actually hold —
      read from a real file or returned by an API. NEVER construct
      base64 from an image you can merely see in the chat: you do not
      have access to attachment bytes, and fabricated base64 fails
      validation or uploads corrupt data. For a file on the user's
      machine, call ``upload_file_widget`` instead. Returns
      ``{"cdn_url", "storage_path", "content_type", "bytes_uploaded"}``. Larger
      bodies are rejected and can exceed the transport's request-size limit, so
      omit it and use the presigned mode.

    Mirrors ``api.views.uploads.ApiUploadView``'s two modes over MCP.
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameYesFile name, e.g. 'face.png'. Only the leaf name is used; directory parts are stripped.
content_typeNoMIME type, e.g. 'image/png'. Recommended. In the presigned path it is signed into the URL, so the PUT must send a matching Content-Type header.
base64_contentNoOPTIONAL — only for tiny in-memory blobs (<= ~1.5 MB): the file body, base64-encoded, uploaded in one call. OMIT for anything larger or on-disk; you then get back a presigned `upload_url` to PUT the bytes straight to S3 (no size cap, nothing base64-encoded through the model).

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?

Annotations only mark it as a non-read-only, non-destructive write; the description adds far more: the presigned vs inline mode mechanics, the returned field sets, the ~1.5 MB inline cap and transport size limit, and the critical warning that cdn_url is dead until the PUT completes. It also warns that fabricated base64 from chat-visible images will fail.

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 gating capability and the two modes clearly delimited. It is wordy and repeats the 'call upload_file_widget instead' fallback three times, and the closing note about mirroring ApiUploadView is implementation detail of little decision value.

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?

With no output schema, the description steps in and documents the return payloads for both modes. For a multi-mode, side-effecting upload tool this covers everything an agent needs to invoke it correctly.

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?

Schema coverage is 100%, so the schema already documents filename, content_type, and base64_content. The description nonetheless adds non-obvious semantics: base64_content's presence toggles the two execution modes, and content_type is signed into the presigned URL so the PUT must match it.

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 + resource ('Upload a file to the workspace CDN') and immediately scopes it to callers that can send HTTP requests. It sharply distinguishes itself from sibling upload_file_widget by naming the exact capability that selects each tool.

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?

Explicit when-to-use and when-not: use this if you can run shell/HTTP, otherwise call upload_file_widget. It also gives mode-selection guidance keyed on base64_content and explains which path to pick by size and origin of the bytes.

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