list_collections
Retrieve all collections (folders) in 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 `listCollections` method implements the core logic of the 'list_collections' tool. It fetches collections from the Metabase API (optionally filtered by namespace) and formats them as a markdown list in the tool 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')}`, }, ], }; }
- Tool schema definition including name, description, and inputSchema for 'list_collections', provided to MCP clients via list_tools.{ 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/dispatch of the 'list_collections' tool call to the CollectionHandlers.listCollections method in the MCP server's executeTool switch statement.case 'list_collections': return await this.collectionHandlers.listCollections(args.namespace);