list_databases
Retrieve all connected data sources in Metabase to identify available databases for querying and analysis.
Instructions
🗄️ [SAFE] List all available databases. Use this to see what data sources are connected to Metabase. Risk: None - read-only operation.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The core handler function that fetches the list of databases from the Metabase API endpoint '/api/database/' and formats them into a readable text response for the MCP tool.async listDatabases() { this.logger.debug('Listing databases'); const response = await this.apiClient.makeRequest('/api/database/'); const databases = Array.isArray(response) ? response : response.data || []; return { content: [ { type: 'text', text: `Available Databases (${databases.length}): ${databases.map(db => `- ID: ${db.id} | Name: ${db.name} | Engine: ${db.engine}` ).join('\n')}`, }, ], }; }
- The tool definition including name, description, and empty input schema (no parameters required). This is used by the MCP server for tool listing and validation.{ name: 'list_databases', description: '🗄️ [SAFE] List all available databases. Use this to see what data sources are connected to Metabase. Risk: None - read-only operation.', inputSchema: { type: 'object', properties: {}, }, },
- src/server/MetabaseMCPServer.js:190-191 (registration)The registration/dispatch point in the executeTool switch statement that routes 'list_databases' tool calls to the appropriate handler method.case 'list_databases': return await this.databaseHandlers.listDatabases();
- src/server/MetabaseMCPServer.js:129-134 (registration)The handler for ListToolsRequest that returns all tool definitions, including list_databases, making it discoverable by MCP clients.this.server.setRequestHandler(ListToolsRequestSchema, async () => { this.logger.debug('Listing tools'); return { tools: TOOL_DEFINITIONS, }; });