Skip to main content
Glama
MikelA92
by MikelA92

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
NameRequiredDescriptionDefault

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: {}, }, },
  • 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();

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/MikelA92/metabase-mcp-mab'

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