Open docs
MCP

Upload and manage content

Let an assistant upload, edit, organize and delete files in a drive it is allowed to use.

Turn on Read files and search and Add and update content for the connection. Changing content needs Add and update content, and reading files and following processing needs Read files and search. Deleting needs Delete content. See permissions.

Every change takes an idempotency_key, and a change to an existing item takes the version you last read. A stale_version answer means someone changed it meanwhile and nothing was written. See rules for every change.

Work on files where they are

Large, binary and media files (video, audio, images, archives, models) are best changed where they live, not downloaded and uploaded again. Ask the assistant to use, in this order:

  1. A mount. With the CLI installed where the assistant runs, flashdrive mount shows the drive as a local folder, so any program can open, edit and save its files. flashdrive pull and flashdrive push give the same result without mounting. See mount, pull and push.
  2. Edits in place. edit_text replaces exact text in a text file. write_bytes writes up to 32,768 bytes from the conversation, and edit_file gives a URL that your shell sends up to 64 MiB per request to. Each makes a new version from the current one plus your change, for example to append to a log or fix a header.
  3. A stream, for programs that only read. get_file returns a URL that answers HTTP Range, so ffmpeg, ffprobe, DuckDB, curl -r and video players seek and read only what they need. read_bytes returns a few raw bytes, such as a file header.
  4. Download and upload again only when a program can use none of these, and have the assistant say why.

Run URLs from get_file, edit_file and upload_transfer in your shell, outside the conversation. They need no Authorization header, so treat them like a password: never paste one into a tool argument, a file or a message.

Edit text in place

edit_text changes a text file (TXT, Markdown, or code and other UTF-8 files) as one new version. Each entry in edits replaces old with new, where old is exact text that occurs exactly once in the file as the earlier edits left it:

{
  "drive_id": "DRIVE_ID",
  "document_id": "DOCUMENT_ID",
  "version": "7",
  "idempotency_key": "fix-install-step-1",
  "edits": [{"old": "Refunds are available within 14 days.", "new": "Refunds are available within 30 days."}]
}

The edits apply in order, all or nothing, to text up to 8 MiB. On edit_text_not_found or edit_text_not_unique, nothing was written and details.index names the edit: read the file again and make old exact, with enough surrounding lines to be unique.

Upload a file

  1. In your shell, find the file's size and SHA-256 (stat, shasum -a 256).
  2. prepare_upload reserves the upload with its external_id, filename, format, size_bytes and sha256, and optionally folder_id and metadata. Use pdf, docx, txt or md for files to read for text, and file for anything else (photos, video, audio, archives, models). A file can be up to 10 GB.
  3. upload_transfer returns a URL, a method and headers.
  4. Your shell sends the original bytes to that URL with exactly those headers and no Authorization header, for example curl -T file.mp4 -H 'Content-Type: application/octet-stream' "$URL". The URL works for this one upload only.
  5. complete_upload starts processing: send {"transport": "direct"} after a direct transfer, {} otherwise.
  6. get_upload and get_operation follow progress until processing finishes.

A PDF or DOCX with no text layer, such as a scan, is kept rather than failed, with text_status none on the document.

To replace an uploaded file, read it with get_document, then send its document_id, external_id and latest_revision (as expected_revision) to prepare_upload.

The client needs access to the local file and a shell to hash and send its bytes. Without one, upload through the Console, the CLI or the SDK. Never paste file contents into the conversation.

Add text

For text that has no file of its own, add_documents takes a list of documents, each with an external_id and text, and optional metadata and folder_id:

{
  "drive_id": "DRIVE_ID",
  "idempotency_key": "refund-policy-edition-1",
  "body": {"documents": [{"external_id": "refund-policy", "text": "Refunds are available within 30 days.", "metadata": {"topic": "support"}}]}
}

The answer includes an operation ID; follow it with get_operation, the workspace ID and the drive ID (drive_id, which the answer names).

update_document replaces the text of a document added this way. Send every metadata field and the folder you want to keep; omitted values are not merged with the previous version. Never use it on an uploaded file: it would drop the file's bytes and name.

Conflict copies

Nothing is overwritten. When a file changed on the drive while someone was working on it in a mount, the drive keeps its version under the file's name and saves the other version beside it as a recovery copy such as name (conflict 20261114T010203Z a1b2c3d4).ext. flashdrive push keeps such a copy in the local working copy instead. See mount, pull and push.

Ask the assistant to resolve each copy and leave none behind:

  1. Find them with the recovery tool.
  2. Compare the copy with the original: read_file for text; for media, get_document metadata and size_bytes.
  3. Text whose changes do not overlap: merge them into the original, delete the copy, and tell you in one line what was merged.
  4. Anything else, and any video or other binary file unless their checksums match: the assistant asks what to keep (the original, the copy, a merge, or both).
  5. Write the result over the original. For an uploaded file, use prepare_upload with the original's document_id, external_id and expected_revision, never update_document, and never delete the original and rename the copy. Then delete the copy, or rename it with move_file if you keep both.

Without write access or a shell, the assistant tells you about the copies instead of resolving them.

Organize or remove content

  • move_file moves a file to another folder and renames it, or both. move_folder moves a folder with everything in it. ensure_folders creates a folder tree in one call before an upload.
  • Read the folder, file or drive before changing or deleting it, and pass its version.
  • delete_folder deletes an empty folder. With recursive: true it deletes the folder and everything in it: the folders go at once, and the assistant calls continue_folder_deletion until state is finished.
  • delete_drive deletes a drive that holds no files or folders and is not the workspace's default. Choose another default before deleting the default drive.

Review what will be deleted with the assistant before it deletes anything. See the tool reference for every tool and its inputs.

Copyright © 2026