Upload file
upload_fileUpload 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
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | File content or file path. | |
| postageBatchId | No | The id of the batch which will be used to perform the upload. | |
| redundancyLevel | No | redundancy level for fault tolerance (higher values provide better fault tolerance but increase storage overhead) 0 - none, 1 - medium, 2 - strong, 3 - insane, 4 - paranoid |