list_collections
Retrieve all collections (folders) from Metabase to understand how cards and dashboards are organized within your instance.
Instructions
📁 [SAFE] List all collections (folders) in Metabase. Collections organize cards and dashboards. Use this to understand the organizational structure. Risk: None - read-only operation.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| namespace | No | Optional namespace filter (e.g., "snippets") |
Implementation Reference
- The handler function that executes the list_collections tool: fetches collections from Metabase API via apiClient and formats them as a text response.async listCollections(namespace = null) { this.logger.debug('Listing collections', { namespace }); const params = namespace ? new URLSearchParams({ namespace }) : ''; const collections = await this.apiClient.makeRequest(`/api/collection/${params ? '?' + params : ''}`); return { content: [ { type: 'text', text: `Collections: ${collections.map(c => `- ID: ${c.id} | Name: ${c.name}${c.description ? ` | ${c.description}` : ''}` ).join('\n')}`, }, ], }; }
- The input schema and description for the list_collections tool, defining optional namespace parameter.{ name: 'list_collections', description: '📁 [SAFE] List all collections (folders) in Metabase. Collections organize cards and dashboards. Use this to understand the organizational structure. Risk: None - read-only operation.', inputSchema: { type: 'object', properties: { namespace: { type: 'string', description: 'Optional namespace filter (e.g., "snippets")', }, }, }, },
- src/server/MetabaseMCPServer.js:200-201 (registration)Registration of the list_collections tool in the MCP server's tool execution switch statement, delegating to collectionHandlers.case 'list_collections': return await this.collectionHandlers.listCollections(args.namespace);
- src/server/MetabaseMCPServer.js:40-40 (registration)Instantiation of the CollectionHandlers class used for list_collections and related tools.this.collectionHandlers = new CollectionHandlers(this.apiClient);