The object tools are the core surface of the R2 MCP Worker. They register automatically on every deployment — no extra environment variables are required beyond theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/XxYouDeaDPunKxX/cloudflare-r2-remote-mcp-worker/llms.txt
Use this file to discover all available pages before exploring further.
R2_BUCKET Workers binding. Together they cover the full lifecycle of objects in the bound bucket: listing and inspecting, reading and writing text content, and safe destructive operations with mandatory confirmation guards. For binary (non-text) objects, see Transfer Tools.
r2_object_list
List objects and delimited prefixes under the configured R2 root prefix.Return only keys that begin with this string. Optional. Combined with
R2_ROOT_PREFIX when scoping is configured.A single character (max 1) used to group keys into virtual directories. Commonly
/. Optional.Maximum number of objects to return. Must be between 1 and
MAX_LIST_LIMIT (default 100). Optional.Pagination cursor returned by a previous truncated response. Optional.
When the response includes
"truncated": true, pass the returned cursor value in your next call to retrieve the next page.r2_object_head
Return metadata for one R2 object without fetching its body. Use this to check whether an object exists and to retrieve its ETag before a conditional write.The relative object key to inspect.
r2_object_get
Read a text-like R2 object and return its content as a UTF-8 string. The object must have a text-compatible content type and must not exceedMAX_INLINE_TEXT_BYTES (default 256 KB). For binary objects or objects exceeding this limit, use r2_download_base64 or a presigned URL.
The relative object key to read.
r2_object_put
Write UTF-8 text to one R2 object. Optionally supplyexpectedEtag to perform a conditional overwrite — the write will be rejected with a 409 conflict if the current object ETag does not match.
The relative object key to write.
UTF-8 text content to store. The encoded byte length must not exceed
MAX_TRANSFER_BYTES (default 1 MB).MIME type to store as the object’s
Content-Type header. Optional.Key-value string pairs stored as custom metadata on the object. Optional.
When supplied, the write succeeds only if the stored object has this ETag. Use to implement optimistic concurrency. Optional.
r2_object_put_if_absent
Create a UTF-8 text object only when the key does not already exist. If the key is already present, the call returns a 409 conflict error and leaves the existing object untouched. This is equivalent to an atomic create-only write using R2’setagDoesNotMatch: "*" condition.
The relative object key to create.
UTF-8 text content to store.
MIME type to store as the object’s
Content-Type. Optional.Key-value string pairs stored as custom metadata. Optional.
r2_object_delete
Delete one R2 object under the configured root prefix. This operation is idempotent — deleting a key that does not exist is not an error.The relative object key to delete.
Must be
true. This literal guard prevents accidental deletion.r2_object_delete_many
Delete multiple R2 objects in a single call. SupplydryRun: true to preview the operation without making any changes to R2.
Array of relative object keys to delete. Must contain at least one key and no more than
MAX_LIST_LIMIT keys (default 100).Must be
true.When
true, returns the planned operation details and does not mutate R2. Optional.r2_object_copy
Copy one R2 object to another key. The operation is implemented as a read of the source followed by a write to the destination — it is not atomic. By default, an existing destination key causes a 409 conflict; setallowOverwrite: true to permit overwriting.
The relative key of the object to copy from.
The relative key to copy into.
When
true, overwrites an existing destination object. Defaults to false. Optional.If supplied, the copy fails with 409 if the source object ETag does not match. Optional.
If supplied, the destination write is conditional on the destination having this ETag. Optional.
r2_object_move
Move one R2 object to a different key. Implemented asr2_object_copy followed by deletion of the source. The operation is not atomic — if the delete step fails, both the source and destination will exist. Use dryRun: true to preview the planned steps before executing.
The relative key of the object to move.
The relative key to move the object to.
Must be
true.When
true, returns the planned steps without mutating R2. Optional.When
true, permits overwriting an existing destination object. Optional.Conditional guard on the source object ETag. Optional.
Conditional guard on the destination object ETag. Optional.
r2_object_rename
Move an object to a new basename within its current prefix, or into an explicittargetPrefix. The new name must differ from the current object name, must not contain path separators, and must not be empty. Internally this performs r2_object_copy + delete, so it inherits the same non-atomicity.
The relative key of the object to rename.
The new basename for the object (minimum 1 character). Must not contain
/ or \.Must be
true.When
true, returns the planned destination key and steps without mutating R2. Optional.If supplied, the object is placed under this prefix rather than the current object’s parent prefix. Optional.
When
true, permits overwriting an existing destination key. Optional.Conditional guard on the source object ETag. Optional.
Conditional guard on the destination object ETag. Optional.
Destructive guards
Destructive tools enforce safety at the schema level. Theconfirm: true field is a required literal — the schema rejects calls that omit it or pass false. The optional dryRun: true field allows callers to preview what would happen before committing.
| Tool | Required guard | Optional guard |
|---|---|---|
r2_object_delete | confirm: true | — |
r2_object_delete_many | confirm: true | dryRun: true |
r2_object_move | confirm: true | dryRun: true |
r2_object_rename | confirm: true | dryRun: true |
dryRun: true is provided, the tool returns a JSON object describing the planned operation — including affected keys and logical steps — and makes no changes to R2.
Text content types
r2_object_get accepts only objects whose content type is recognized as text-like. The following types are allowed:
- Any type beginning with
text/(e.g.,text/plain,text/html,text/csv,text/markdown) application/jsonapplication/ld+jsonapplication/xmlapplication/yamlapplication/x-yamlapplication/javascriptapplication/x-javascriptapplication/typescript
null or absent content type are also treated as text-like. Objects with any other content type — such as image/png or application/octet-stream — must be accessed via r2_download_base64 or a presigned URL.