Skip to main content
Glama

Upload file

upload_file

Upload a single file to Swarm decentralized storage using a local file path or raw text content. Returns a retrievable reference, with optional redundancy level and postage batch settings.

Instructions

Upload a SINGLE file to Swarm. To upload a local file, pass its filesystem path as data — the server reads the file itself (stdio mode only). Alternatively, pass the raw text content directly as data. This tool handles one file only — if the path refers to a directory, or the user mentions "folder", "directory", "the contents of", or otherwise asks to upload more than one file, use upload_folder instead and pass the path as its folderPath. Never ask the user for the file content when a path is given, and never pass a Swarm reference — references are the OUTPUT of this tool, not an input. Small files upload synchronously and return a reference. Large files (over the server's deferred-upload threshold) upload in the background and immediately return the final reference (computed locally) plus a tagId for query_upload_progress; the content becomes retrievable at the reference once the upload completes. With redundancyLevel > 0 only the tagId is returned immediately. Optional options (ignore if they are not requested): redundancyLevel: redundancy level for fault tolerance. Optional, value is 0 if not requested. postageBatchId: The postage stamp batch ID which will be used to perform the upload, if it is provided.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYesFile content or file path.
postageBatchIdNoThe id of the batch which will be used to perform the upload.
redundancyLevelNoredundancy level for fault tolerance (higher values provide better fault tolerance but increase storage overhead) 0 - none, 1 - medium, 2 - strong, 3 - insane, 4 - paranoid

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.9.5

TDQS

A5/5.0
Behavior5/5

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

With no annotations provided, the description carries the full burden and does so thoroughly. It discloses that local paths only work in stdio mode, that the server reads the file itself, that large files upload asynchronously, and that with redundancyLevel > 0 only the tagId is returned immediately. It also states that references are the tool's output, not an input.

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 long but every sentence earns its place: core usage modes, routing to upload_folder, behavioral notes on sync/async uploads, and optional parameters all serve the agent's decision-making. The most critical constraints are front-loaded, and the optional parameters are logically grouped at the end.

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 a tool with no annotations and no output schema, the description is remarkably complete. It explains return behavior (reference, tagId, query_upload_progress), deferred uploads, redundancy behavior, and the alternative tool. An agent has enough information to select and invoke this tool correctly in a wide range of contexts.

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?

Although schema coverage is 100%, the description adds substantial meaning beyond the schema: it explains how to pass a filesystem path versus raw text for `data`, notes stdio-only limitation, and details the optional semantics of redundancyLevel and postageBatchId. This goes far beyond the bare schema 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 defines the tool as uploading a SINGLE file to Swarm, with specific content modes (filesystem path or raw text). It explicitly differentiates from upload_folder by stating that this tool is for one file only, and clarifies that Swarm references are outputs, not inputs.

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?

The description gives explicit when-to-use and when-not-to-use guidance: if the user mentions "folder", "directory", "the contents of", or requests more than one file, the agent should use upload_folder instead. It also instructs the agent never to ask for file content when a path is given and never to pass a Swarm reference as input.

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