Cloudflare R2 storage handler for fractary-file plugin
Executes file operations on Cloudflare R2 storage using S3-compatible API. Triggers when performing uploads, downloads, deletions, or URL generation for R2 buckets.
/plugin marketplace add fractary/claude-plugins/plugin install fractary-file@fractaryThis skill inherits all available tools. When active, it can use any tool Claude has access to.
scripts/delete.shscripts/download.shscripts/get-url.shscripts/list.shscripts/read.shscripts/upload.sh<CRITICAL_RULES>
{
"handlers": {
"r2": {
"account_id": "${R2_ACCOUNT_ID}",
"access_key_id": "${R2_ACCESS_KEY_ID}",
"secret_access_key": "${R2_SECRET_ACCESS_KEY}",
"bucket_name": "my-bucket",
"public_url": "https://pub-xxxxx.r2.dev",
"region": "auto"
}
}
}
Configuration Fields:
account_id: Cloudflare account ID (required)access_key_id: R2 API access key (required)secret_access_key: R2 API secret key (required)bucket_name: R2 bucket name (required)public_url: Public URL for bucket (optional, needed for public files)region: AWS region (default: "auto" for R2)Security Best Practices:
${R2_ACCESS_KEY_ID}See docs/r2-setup-guide.md for detailed setup instructions. </CONFIGURATION>
<WORKFLOW> 1. Load handler configuration from request 2. Validate operation parameters 3. Expand environment variables in credentials 4. Prepare R2-specific parameters (endpoint, bucket, credentials) 5. Execute AWS CLI command via script 6. Parse script output 7. Return structured result to agentParameter Flow:
{
"success": true,
"message": "Operation completed successfully",
"url": "https://pub-xxxxx.r2.dev/path/to/file",
"size_bytes": 1024,
"checksum": "sha256:abc123..."
}
Public File Upload:
{
"success": true,
"message": "File uploaded successfully (public)",
"url": "https://pub-xxxxx.r2.dev/docs/document.pdf",
"size_bytes": 2048,
"checksum": "sha256:def456..."
}
Presigned URL:
{
"success": true,
"message": "Presigned URL generated",
"url": "https://account.r2.cloudflarestorage.com/bucket/file?X-Amz-Signature=...",
"expires_in": 3600
}
</OUTPUTS>
<ERROR_HANDLING>