list_metrics
Retrieve all saved metrics and reusable aggregations from Metabase, including calculations like total revenue and average order value.
Instructions
📊 [SAFE] List all metrics (saved aggregations) in Metabase. Metrics are reusable calculations like "Total Revenue" or "Average Order Value". Risk: None - read-only operation.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The core handler function that executes the list_metrics tool. It calls the Metabase API /api/metric, formats the metrics into a human-readable text list, and gracefully handles 404 errors for incompatible Metabase versions.async listMetrics() { this.logger.debug('Listing metrics'); try { const metrics = await this.apiClient.makeRequest('/api/metric'); return { content: [ { type: 'text', text: `Metrics: ${metrics.map(m => `- ID: ${m.id} | Name: ${m.name} | Table: ${m.table?.name}${m.description ? ` | ${m.description}` : ''}` ).join('\n')}`, }, ], }; } catch (error) { if (error.message.includes('404')) { return { content: [{ type: 'text', text: 'Metrics endpoint not available in this Metabase version' }], }; } throw error; } }
- The tool schema definition specifying the name, description, and input schema (no parameters required) for list_metrics. Used by the MCP server to advertise the tool.{ name: 'list_metrics', description: '📊 [SAFE] List all metrics (saved aggregations) in Metabase. Metrics are reusable calculations like "Total Revenue" or "Average Order Value". Risk: None - read-only operation.', inputSchema: { type: 'object', properties: {}, }, },
- src/server/MetabaseMCPServer.js:218-219 (registration)The dispatch/registration in the executeTool switch statement that routes calls to the 'list_metrics' tool to the appropriate handler method.case 'list_metrics': return await this.segmentMetricHandlers.listMetrics();