Custom Tools

File Storage

File storage lets you upload and manage files that your tools can reference. Store brand assets, generated reports, uploaded receipts, or any file your workflows need. Files are stored in Cloudflare R2 with per-user quotas and accessible across all your tools.


Limits

TierPer-file maxTotal storage
Free5 MB100 MB
Pro5 MB2 GB
Team5 MB5 GB

Accepted file types: any (images, PDFs, documents, etc). Known types (JPEG, PNG, WebP, PDF) are validated via magic bytes.


Upload a File

Programmatic Upload (via MCP tool)

assets(action="upload", filename="logo.png", content_type="image/png", data_base64="iVBOR...")

Browser Upload (Presigned URL)

Get a one-time upload link for drag-and-drop in your browser:

assets(action="upload_link")

Returns a URL you can open to upload the file directly. Link expires in 15 minutes.

From Code Tools (files.mjs)

Code tools with file_storage: true get a files.mjs helper injected automatically:

import { upload, download, remove, list, getUploadUrl } from './files.mjs';

// Upload raw bytes (multipart — no base64 overhead)
const result = await upload(buffer, 'report.pdf', 'application/pdf');
// => { fileId, r2Key, size }

// Upload from base64 string (auto-decoded, sent as multipart)
const result = await upload(base64String, 'logo.png', 'image/png');

// Get a browser upload URL
const { uploadUrl } = await getUploadUrl();

The upload() function accepts a base64 string, Buffer, or Uint8Array. It sends the file as multipart form data to avoid base64 bloat over the wire.


List Files

assets(action="list")
assets(action="list", tag="brand")

Download a File

assets(action="get", file_id="file_abc123")

Organize with Tags

assets(action="tag", file_id="file_abc123", tag="q1-reports")

Delete a File

assets(action="delete", file_id="file_abc123")

Use Cases

  • Brand assets — Logos and images for generated reports or emails
  • Receipt tracking — Attach uploaded receipt images to expense records
  • Report archives — Store generated PDFs for later retrieval
  • Configuration files — Templates, schemas, or reference data
  • Document processing — Upload documents for analysis or transformation
Previous
Email Triggers
Next
memory