Skip to main content
Glama
HenkDz

Self-Hosted Supabase MCP Server

list_storage_buckets

Retrieve all storage buckets from your self-hosted Supabase project to manage and organize file storage directly within your development environment.

Instructions

Lists all storage buckets in the project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The tool handler definition including the execute function that queries the storage.buckets table via direct PG connection and validates the output.
    export const listStorageBucketsTool = {
        name: 'list_storage_buckets',
        description: 'Lists all storage buckets in the project.',
        mcpInputSchema,
        inputSchema,
        outputSchema: ListStorageBucketsOutputSchema,
    
        execute: async (
            input: Input,
            context: ToolContext
        ): Promise<ListStorageBucketsOutput> => {
            const client = context.selfhostedClient;
            // Use console.error for operational logging
            console.error('Listing storage buckets...');
    
            // Check if direct DB connection is available, as it's likely needed for storage schema
            if (!client.isPgAvailable()) {
                // Log error for MCP client
                context.log('Direct database connection (DATABASE_URL) is required to list storage buckets.', 'error');
                throw new Error('Direct database connection (DATABASE_URL) is required to list storage buckets.');
            }
    
            const sql = `
                SELECT
                    id,
                    name,
                    owner,
                    public,
                    avif_autodetection,
                    file_size_limit,
                    allowed_mime_types,
                    created_at::text, -- Cast to text
                    updated_at::text  -- Cast to text
                FROM storage.buckets;
            `;
    
            console.error('Attempting to list storage buckets using direct DB connection...');
            const result = await client.executeSqlWithPg(sql);
    
            // Validate and return using handler
            const validatedBuckets = handleSqlResponse(result, ListStorageBucketsOutputSchema);
    
            console.error(`Found ${validatedBuckets.length} buckets.`);
            context.log(`Found ${validatedBuckets.length} buckets.`); // Also log for MCP
            return validatedBuckets;
        },
    };
  • Zod schemas for output validation: BucketSchema and ListStorageBucketsOutputSchema (array of buckets).
    const BucketSchema = z.object({
        id: z.string(),
        name: z.string(),
        owner: z.string().nullable(),
        public: z.boolean(),
        avif_autodetection: z.boolean(),
        file_size_limit: z.number().nullable(),
        allowed_mime_types: z.array(z.string()).nullable(),
        // Keep timestamps as strings as returned by DB/pg
        created_at: z.string().nullable(),
        updated_at: z.string().nullable(),
    });
    
    const ListStorageBucketsOutputSchema = z.array(BucketSchema);
    type ListStorageBucketsOutput = StorageBucket[];
  • Input schemas: empty object schema for no inputs (MCP static JSON and Zod).
    export const mcpInputSchema = {
        type: 'object',
        properties: {},
        required: [],
    };
    
    // Zod schema for runtime input validation
    const inputSchema = z.object({});
  • src/index.ts:98-121 (registration)
    Registration of all tools including list_storage_buckets in the availableTools object used by the MCP server.
    const availableTools = {
        // Cast here assumes tools will implement AppTool structure
        [listTablesTool.name]: listTablesTool as AppTool,
        [listExtensionsTool.name]: listExtensionsTool as AppTool,
        [listMigrationsTool.name]: listMigrationsTool as AppTool,
        [applyMigrationTool.name]: applyMigrationTool as AppTool,
        [executeSqlTool.name]: executeSqlTool as AppTool,
        [getDatabaseConnectionsTool.name]: getDatabaseConnectionsTool as AppTool,
        [getDatabaseStatsTool.name]: getDatabaseStatsTool as AppTool,
        [getProjectUrlTool.name]: getProjectUrlTool as AppTool,
        [getAnonKeyTool.name]: getAnonKeyTool as AppTool,
        [getServiceKeyTool.name]: getServiceKeyTool as AppTool,
        [generateTypesTool.name]: generateTypesTool as AppTool,
        [rebuildHooksTool.name]: rebuildHooksTool as AppTool,
        [verifyJwtSecretTool.name]: verifyJwtSecretTool as AppTool,
        [listAuthUsersTool.name]: listAuthUsersTool as AppTool,
        [getAuthUserTool.name]: getAuthUserTool as AppTool,
        [deleteAuthUserTool.name]: deleteAuthUserTool as AppTool,
        [createAuthUserTool.name]: createAuthUserTool as AppTool,
        [updateAuthUserTool.name]: updateAuthUserTool as AppTool,
        [listStorageBucketsTool.name]: listStorageBucketsTool as AppTool,
        [listStorageObjectsTool.name]: listStorageObjectsTool as AppTool,
        [listRealtimePublicationsTool.name]: listRealtimePublicationsTool as AppTool,
    };
  • src/index.ts:32-32 (registration)
    Import of the list_storage_buckets tool module.
    import listStorageBucketsTool from './tools/list_storage_buckets.js';
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('Lists') but doesn't describe how the listing works—e.g., whether it returns all buckets at once, uses pagination, requires specific permissions, or has rate limits. For a read operation with zero annotation coverage, this leaves significant gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence that directly states the tool's purpose without any wasted words. It is front-loaded and efficiently conveys the essential information, making it easy for an agent to parse and understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is minimally adequate. It tells what the tool does but lacks details on behavior, output format, or usage context. For a list operation, more information on return values or constraints would be helpful, but the low complexity keeps it from being severely incomplete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% description coverage, so no parameter documentation is needed. The description doesn't add parameter information, which is appropriate here. A baseline of 4 is given as it correctly avoids redundancy, though it doesn't compensate for any gaps (none exist).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Lists') and resource ('all storage buckets in the project'), making the tool's function immediately understandable. It doesn't explicitly differentiate from sibling tools like 'list_storage_objects' or 'list_tables', but the specificity of 'storage buckets' provides adequate distinction. The purpose is unambiguous though not maximally differentiated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'list_storage_objects' (which might list objects within buckets) or 'get_database_connections' (which might relate to storage), nor does it specify prerequisites or contexts for use. The agent must infer usage from the name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/HenkDz/selfhosted-supabase-mcp'

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