Skip to main content

Documentation 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.

This page is the complete parameter and return-type reference for all 10 R2 object tools registered by the Cloudflare R2 Remote MCP Worker. Every input is validated with a Zod schema at call time; each tool returns a typed JSON result or surfaces a structured R2McpError with a machine-readable code and HTTP status.

r2_object_list

List objects stored under the configured R2_ROOT_PREFIX. Results are always scoped to the root prefix — keys returned in objects are relative to that prefix.

Parameters

prefix
string
Filter results to keys that begin with this prefix, relative to R2_ROOT_PREFIX. Omit to list all objects in the bucket scope.
limit
integer
Maximum number of objects to return. Must be between 1 and MAX_LIST_LIMIT (default 100). Defaults to MAX_LIST_LIMIT when omitted.
cursor
string
Opaque pagination cursor returned in a previous truncated response. Pass this value to fetch the next page of results.
delimiter
string
Single-character delimiter used to group keys into virtual directories. Maximum length: 1 character. Common value: "/".

Returns

objects
ObjectMetadata[]
required
Array of object metadata records for each key in the page. See ObjectMetadata type for field details.
delimitedPrefixes
string[]
required
Common key prefixes collapsed by the delimiter, relative to R2_ROOT_PREFIX. Empty when delimiter is not provided.
truncated
boolean
required
true when more results exist beyond this page. Use the returned cursor to fetch the next page.
cursor
string
Opaque pagination cursor. Present only when truncated is true.
rootPrefix
string
required
The resolved R2_ROOT_PREFIX in effect for this call. Useful for debugging scope.

Error codes

This tool returns an empty result set rather than an error when the bucket is empty or no objects match the prefix. No R2McpError codes are raised under normal conditions.

r2_object_head

Return metadata for a single R2 object without downloading its body. Equivalent to an HTTP HEAD request.

Parameters

key
string
required
Relative object key, scoped to R2_ROOT_PREFIX. Must not contain .., null bytes, or be an absolute path.

Returns

Returns an ObjectMetadata object directly.
key
string
required
Relative object key.
size
number
required
Object size in bytes.
contentType
string | null
required
MIME type stored with the object, or null if not set.
etag
string
required
ETag of the stored object.
lastModified
string | null
required
ISO 8601 timestamp of the last write, or null if unavailable.
customMetadata
object
required
Key-value pairs of custom metadata attached to the object.

Error codes

CodeHTTP StatusMeaning
object_not_found404No object exists at the given key.

r2_object_get

Read the body of a text-like R2 object. The tool checks that the object’s contentType is text-like (e.g. text/*, application/json, application/yaml, etc.) and that its size does not exceed MAX_INLINE_TEXT_BYTES (default 256 KiB) before fetching.

Parameters

key
string
required
Relative object key, scoped to R2_ROOT_PREFIX.

Returns

key
string
required
Relative object key.
content
string
required
UTF-8 decoded body of the object.
contentType
string | null
required
MIME type of the object, or null if not set.
etag
string
required
ETag of the stored object.
size
number
required
Object size in bytes.
lastModified
string | null
required
ISO 8601 timestamp of the last write, or null if unavailable.

Error codes

CodeHTTP StatusMeaning
object_not_found404No object exists at the given key.
unsupported_content_type415Object has a binary or unsupported MIME type. Use r2_download_base64 instead.
payload_too_large413Object size exceeds MAX_INLINE_TEXT_BYTES.

r2_object_put

Write a UTF-8 text string to an R2 object. Optionally supply expectedEtag to perform a conditional overwrite — the write is rejected if the stored ETag does not match.

Parameters

key
string
required
Relative object key, scoped to R2_ROOT_PREFIX.
text
string
required
UTF-8 text body to store. The UTF-8 encoded byte length must not exceed MAX_TRANSFER_BYTES (default 1 MiB).
contentType
string
MIME type to store with the object (e.g. text/plain, application/json).
customMetadata
object
Arbitrary string key-value pairs to attach as custom metadata.
expectedEtag
string
If provided, the write only succeeds when the current stored ETag matches this value exactly. Use "*" to require that the object already exists.

Returns

Returns the ObjectMetadata of the newly written object.

Error codes

CodeHTTP StatusMeaning
payload_too_large413UTF-8 encoded text exceeds MAX_TRANSFER_BYTES.
etag_conflict409expectedEtag was supplied and the current ETag did not match.
invalid_path400Key contains .., null bytes, or is otherwise invalid.

r2_object_put_if_absent

Write a UTF-8 text object only when no object currently exists at the given key. Internally uses R2’s etagDoesNotMatch: "*" condition.

Parameters

key
string
required
Relative object key, scoped to R2_ROOT_PREFIX.
text
string
required
UTF-8 text body to store. The UTF-8 encoded byte length must not exceed MAX_TRANSFER_BYTES.
contentType
string
MIME type to store with the object.
customMetadata
object
Arbitrary string key-value pairs to attach as custom metadata.

Returns

Returns the ObjectMetadata of the newly created object.

Error codes

CodeHTTP StatusMeaning
payload_too_large413UTF-8 encoded text exceeds MAX_TRANSFER_BYTES.
object_already_exists409An object already exists at the given key.
invalid_path400Key contains .., null bytes, or is otherwise invalid.

r2_object_delete

Delete a single R2 object. The confirm: true field is required to prevent accidental deletion.
This operation is destructive and cannot be undone. R2 does not maintain a recycle bin.

Parameters

key
string
required
Relative object key, scoped to R2_ROOT_PREFIX.
confirm
true
required
Must be the literal boolean true. This field is a required safety guard.

Returns

deleted
true
required
Always true on success.
key
string
required
The relative key of the deleted object.

Error codes

CodeHTTP StatusMeaning
invalid_path400Key contains .., null bytes, or is otherwise invalid.
R2 does not return an error when deleting a key that does not exist. The response will still show deleted: true.

r2_object_delete_many

Delete multiple R2 objects in a single call. Use dryRun: true to preview what would be deleted without actually removing any objects.
This operation is destructive and cannot be undone.

Parameters

keys
string[]
required
Array of relative object keys to delete. Minimum 1 key, maximum MAX_LIST_LIMIT keys (default 100).
confirm
true
required
Must be the literal boolean true. This field is a required safety guard.
dryRun
boolean
When true, no objects are deleted. The response describes what would have been deleted. Defaults to false.

Returns

Live run (dryRun omitted or false):
deletedKeys
string[]
required
Array of relative keys that were deleted.
Dry run (dryRun: true):
dryRun
true
required
Always true when a dry run was requested.
operation
string
required
Always "r2_object_delete_many".
keys
string[]
required
The keys that would have been deleted.
wouldDeleteCount
number
required
Number of keys that would be deleted.

Error codes

CodeHTTP StatusMeaning
invalid_path400One or more keys contain .., null bytes, or are otherwise invalid.

r2_object_copy

Copy a source object to a destination key within the same R2 bucket. The operation reads the source body (subject to MAX_TRANSFER_BYTES) and writes it to the destination, preserving contentType and customMetadata.

Parameters

sourceKey
string
required
Relative key of the source object.
destinationKey
string
required
Relative key where the copy will be written.
allowOverwrite
boolean
When false (default), the copy is aborted if the destination already exists. Set to true to overwrite an existing destination.
expectedSourceEtag
string
If provided, the copy is aborted when the source object’s ETag does not match this value.
expectedDestinationEtag
string
If provided, the destination write is conditional on the current destination ETag matching this value.

Returns

source
ObjectMetadata
required
Metadata of the source object at the time of the copy.
destination
ObjectMetadata
required
Metadata of the newly written destination object.

Error codes

CodeHTTP StatusMeaning
object_not_found404Source key does not exist.
destination_exists409Destination key exists and allowOverwrite is not true.
etag_conflict409expectedSourceEtag or expectedDestinationEtag did not match the stored ETag.
payload_too_large413Source object size exceeds MAX_TRANSFER_BYTES.

r2_object_move

Move a source object to a destination key. This is a copy-then-delete operation and is not atomic. Use dryRun: true to preview the steps without making changes.
Move is not atomic. If the delete step fails after the copy succeeds, both the source and destination will exist.

Parameters

sourceKey
string
required
Relative key of the object to move.
destinationKey
string
required
Relative key of the destination.
confirm
true
required
Must be the literal boolean true.
allowOverwrite
boolean
When true, an existing destination object will be overwritten. Defaults to false.
dryRun
boolean
When true, no changes are made. Returns a preview of the planned steps.
expectedSourceEtag
string
Abort the move if the source ETag does not match this value.
expectedDestinationEtag
string
Abort the destination write if the destination ETag does not match this value.

Returns

Live run:
sourceKey
string
required
The original key that was moved.
deletedSourceKey
string
required
The source key that was deleted after the copy.
destination
ObjectMetadata
required
Metadata of the written destination object.
Dry run (dryRun: true):
dryRun
true
required
Always true.
operation
string
required
Always "r2_object_move".
sourceKey
string
required
Source key that would be moved.
destinationKey
string
required
Destination key that would be written.
steps
string[]
required
Ordered list of steps that would be executed: ["copy source to destination", "delete source"].
allowOverwrite
boolean
required
Resolved value of allowOverwrite.
expectedSourceEtag
string | null
required
Value of expectedSourceEtag, or null if not supplied.
expectedDestinationEtag
string | null
required
Value of expectedDestinationEtag, or null if not supplied.

Error codes

CodeHTTP StatusMeaning
object_not_found404Source key does not exist.
destination_exists409Destination exists and allowOverwrite is not true.
etag_conflict409Source or destination ETag mismatch.
payload_too_large413Source object size exceeds MAX_TRANSFER_BYTES.

r2_object_rename

Rename an R2 object within its current prefix or move it to an explicit targetPrefix. The new name must be a basename — it cannot contain / or \. Internally delegates to r2_object_move.

Parameters

currentKey
string
required
Relative key of the object to rename.
newName
string
required
New basename for the object. Must be at least 1 character, must not contain / or \, and must differ from the current basename.
confirm
true
required
Must be the literal boolean true.
targetPrefix
string
Explicit destination prefix. When omitted, the parent prefix of currentKey is used (the object stays in the same “folder”).
allowOverwrite
boolean
When true, an existing object at the computed destination key will be overwritten. Defaults to false.
dryRun
boolean
When true, no changes are made. Returns a preview of the planned operation.
expectedSourceEtag
string
Abort the rename if the source ETag does not match this value.
expectedDestinationEtag
string
Abort the destination write if the destination ETag does not match this value.

Returns

Live run:
sourceKey
string
required
The original key that was renamed.
deletedSourceKey
string
required
The source key that was deleted after the copy.
destinationKey
string
required
The computed destination key (prefix + newName).
destination
ObjectMetadata
required
Metadata of the newly written destination object.
Dry run (dryRun: true):
dryRun
true
required
Always true.
operation
string
required
Always "r2_object_rename".
currentKey
string
required
The key that would be renamed.
newName
string
required
The new basename.
targetPrefix
string | null
required
The resolved target prefix, or null if defaulting to the current parent prefix.
steps
string[]
required
Ordered list of steps: ["copy current key to renamed destination", "delete current key"].
allowOverwrite
boolean
required
Resolved value of allowOverwrite.
expectedSourceEtag
string | null
required
Value of expectedSourceEtag, or null if not supplied.
expectedDestinationEtag
string | null
required
Value of expectedDestinationEtag, or null if not supplied.

Error codes

CodeHTTP StatusMeaning
no_op_rename400newName is identical to the current object’s basename.
invalid_path400newName contains /, \, null bytes, or is empty after trimming.
object_not_found404Source key does not exist.
destination_exists409Destination exists and allowOverwrite is not true.
etag_conflict409Source or destination ETag mismatch.

ObjectMetadata type

All metadata-returning tools share this shape.
key
string
required
Relative object key, scoped to R2_ROOT_PREFIX.
size
number
required
Object size in bytes.
contentType
string | null
required
MIME type stored with the object, or null if not set.
etag
string
required
ETag of the stored object.
lastModified
string | null
required
ISO 8601 UTC timestamp of the last write (uploaded field from the R2 API), or null if unavailable.
customMetadata
object
required
Arbitrary string key-value pairs attached to the object. Empty object {} when none are set.

Error Codes

The following R2McpError codes can be returned by object tools. Each error carries a machine-readable code, an HTTP status, a human-readable message, and optional details.
CodeHTTP StatusMeaning
object_not_found404Object key not found in R2.
unsupported_content_type415Object content type is not text-like. Use r2_download_base64 for binary objects.
payload_too_large413Object or text payload exceeds MAX_INLINE_TEXT_BYTES or MAX_TRANSFER_BYTES.
etag_conflict409A conditional write or copy failed because the stored ETag did not match expectedEtag.
object_already_exists409r2_object_put_if_absent failed because an object already exists at the key.
destination_exists409Copy or move destination already exists and allowOverwrite was not set to true.
no_op_rename400The newName supplied to r2_object_rename is identical to the current basename.
invalid_path400Key contains .., a leading /, null bytes, or a basename with path separators.
out_of_scope403Key falls outside the configured R2_ROOT_PREFIX scope.

Build docs developers (and LLMs) love