Skip to main content
Glama

setup_buckets

Initialize standard storage buckets to organize file management workflows using a base bucket name and user identifier for structured data organization.

Instructions

Initialize standard storage buckets for organized file management workflows

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
base_bucket_nameNoBase name for bucketsstorage
user_idNoUser identifier for organization

Implementation Reference

  • Main handler function that initializes standard Supabase storage buckets (images and exports) with security configurations, handling creation idempotently and returning structured results.
    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:85-106 (registration)
    Tool registration in the MCP ListTools handler, defining name, description, and input schema.
    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/index.ts:467-468 (registration)
    Dispatch in the main CallToolRequestSchema switch statement to the handler function.
    case 'setup_buckets': return await handleSetupBuckets(args, requestId, startTime);
  • TypeScript interface defining the output structure for the setup_buckets tool result.
    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; }; }; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Desmond-Labs/supabase-storage-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server