setup_buckets
Initialize standard storage buckets to organize file management workflows with structured naming conventions.
Instructions
Initialize standard storage buckets for organized file management workflows
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "setup_buckets"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| base_bucket_name | No | Base name for buckets | storage |
| user_id | No | User identifier for organization |
Implementation Reference
- src/index.ts:563-626 (handler)The main handler function that implements the setup_buckets tool logic. It creates standard buckets like {base_bucket_name}-images and {base_bucket_name}-exports with security configurations, audits the request, and returns a structured result.
async function handleSetupBuckets(args: any, requestId: string, startTime: number) { const { base_bucket_name = 'storage', user_id } = args; const inputHash = generateSecureHash(JSON.stringify({ base_bucket_name, user_id })); try { const bucketsToCreate = [ `${base_bucket_name}-images`, `${base_bucket_name}-exports` ]; const bucketsCreated: string[] = []; for (const bucketName of bucketsToCreate) { const { data, error } = await supabase.storage.createBucket(bucketName, { public: false, fileSizeLimit: 50 * 1024 * 1024, // 50MB allowedMimeTypes: ['image/jpeg', 'image/png', 'image/webp', 'image/gif'] }); if (error && !error.message.includes('already exists')) { throw new Error(`Failed to create bucket ${bucketName}: ${error.message}`); } bucketsCreated.push(bucketName); } auditRequest('setup_buckets', true, inputHash); const result: SetupBucketsResult = { success: true, buckets_created: bucketsCreated, message: `Successfully created bucket structure: ${bucketsCreated.join(', ')}`, security_configuration: { images_bucket: { public: false, file_size_limit: 50 * 1024 * 1024, allowed_mime_types: ['image/jpeg', 'image/png', 'image/webp', 'image/gif'], audit_logging_enabled: true, threat_detection_enabled: true }, exports_bucket: { public: false, file_size_limit: 50 * 1024 * 1024, allowed_mime_types: ['image/jpeg', 'image/png', 'image/webp', 'image/gif'], audit_logging_enabled: true, threat_detection_enabled: true } } }; return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) } ] }; } catch (error) { auditRequest('setup_buckets', false, inputHash, getErrorMessage(error)); throw error; } } - src/index.ts:84-106 (registration)Tool registration in the ListToolsRequestSchema handler, defining the name, description, and input schema for setup_buckets.
{ name: 'setup_buckets', description: 'Initialize standard storage buckets for organized file management workflows', inputSchema: { type: 'object', properties: { base_bucket_name: { type: 'string', description: 'Base name for buckets', default: 'storage', minLength: 3, maxLength: 50 }, user_id: { type: 'string', description: 'User identifier for organization', maxLength: 36 } }, required: [], additionalProperties: false } }, - src/modules/types.ts:228-248 (schema)Type definition for the output/result of the setup_buckets tool, used in the handler for structuring the response.
export interface SetupBucketsResult { success: boolean; buckets_created: string[]; message: string; security_configuration: { images_bucket: { public: boolean; file_size_limit: number; allowed_mime_types: string[]; audit_logging_enabled: boolean; threat_detection_enabled: boolean; }; exports_bucket: { public: boolean; file_size_limit: number; allowed_mime_types: string[]; audit_logging_enabled: boolean; threat_detection_enabled: boolean; }; }; } - src/index.ts:467-468 (registration)Dispatch case in the main CallToolRequestSchema switch statement that routes calls to the setup_buckets handler.
case 'setup_buckets': return await handleSetupBuckets(args, requestId, startTime);