Skip to main content
Glama

Upload file

upload_file

Send a local batch or image file to TokenLab or Anthropic Files API, returning metadata for batch or vision workflows.

Instructions

Uploads a TokenLab/OpenAI-compatible batch or image file. With anthropic-beta: files-api-2025-04-14, uploads an Anthropic Files resource without a purpose field and returns Anthropic file metadata.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileYesPass local file path.
modelNoOptional TokenLab extension for image file uploads. Defaults to gpt-image-2 and binds the returned …
purposeNoRequired in TokenLab/OpenAI-compatible mode: use batch for Batch API JSONL files, or user_data/visi…
anthropic-betaNoInclude files-api-2025-04-14 to use Anthropic Files API mode.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.6.24
    • changedInput schema / properties / model / description
      Previous value: -"Optional TokenLab extension for image file uploads. Defaults to gpt-image-2 and binds the returned file_id to the selected image-edit configuration."New value: +"Optional TokenLab extension for image file uploads. Defaults to gpt-image-2 and binds the returned …"
    • changedInput schema / properties / purpose / description
      Previous value: -"Required in TokenLab/OpenAI-compatible mode: use batch for Batch API JSONL files, or user_data/vision for image edits. Omit in Anthropic Files mode."New value: +"Required in TokenLab/OpenAI-compatible mode: use batch for Batch API JSONL files, or user_data/visi…"
  2. Changed4 schema fields changedv0.6.4
    • removedInput schema / $schema
      Removed value: -"http://json-schema.org/draft-07/schema#"
    • addedInput schema / properties / anthropic-beta
      Added value: +{
      +  "description": "Include files-api-2025-04-14 to use Anthropic Files API mode.",
      +  "type": "string"
      +}
    • changedInput schema / properties / purpose / description
      Previous value: -"Use batch for Batch API JSONL files. Use user_data or vision for image files that will be referenced from image edits."New value: +"Required in TokenLab/OpenAI-compatible mode: use batch for Batch API JSONL files, or user_data/vision for image edits. Omit in Anthropic Files mode."
    • changedInput schema / required
      Previous value: -[
      -  "file",
      -  "purpose"
      -]New value: +[
      +  "file"
      +]
  3. Addedv0.3.1

TDQS

A3.5/5.0
Behavior3/5

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

Annotations already declare readOnly=false, idempotent=false, openWorld=true, destructive=false, so the safety profile is covered. The description adds real value by explaining the two-mode behavior and that Anthropic mode omits the purpose field and returns Anthropic file metadata, but it does not mention that repeat uploads are non-idempotent (duplicates) or any auth requirements.

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?

Two dense sentences with no filler, front-loading the primary action before the mode-specific behavior. Slightly technical phrasing but every clause carries information.

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?

For a 4-parameter upload tool with no output schema, the description covers both operating modes and notes the Anthropic return metadata. Remaining gaps (non-idempotency, error cases) are minor given the annotations and complete schema coverage.

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

Parameters3/5

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

Schema description coverage is 100%, with the schema itself explaining file path, model default, purpose enum, and the anthropic-beta value. The description corroborates the anthropic-beta/purpose interaction but adds no syntax or format detail beyond the schema, so the baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource (uploads a batch or image file) and names the two API modes it supports. It distinguishes itself from siblings like list_files/retrieve_file, though it never explicitly contrasts with create_image_file or the other create_* tools that an agent might confuse it with.

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

Usage Guidelines3/5

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

Usage is implied through the conditional mode description: the anthropic-beta value triggers Anthropic Files mode, and 'purpose' is described as required in TokenLab/OpenAI mode. However, there is no explicit when-to-use guidance or named alternative for choosing upload_file over create_image_file or edit_image_file, so the agent must infer.

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