Skip to main content
Glama
MikelA92

Metabase MCP Server

by MikelA92

list_metrics

Retrieve all saved metrics from Metabase, including reusable aggregations like total revenue and average order value, for data analysis.

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 in SegmentMetricHandlers class that fetches metrics from Metabase API (/api/metric), formats them into a readable text list, and handles cases where the endpoint is unavailable (e.g., older 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;
        }
      }
  • Tool definition including name, description, and input schema (no parameters required). This is part of the TOOL_DEFINITIONS array used for tool discovery.
    {
      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: {},
      },
    },
  • Registration in the main server switch statement that dispatches 'list_metrics' tool calls to the segmentMetricHandlers.listMetrics() method.
    case 'list_metrics':
      return await this.segmentMetricHandlers.listMetrics();
  • Tool list registration: returns TOOL_DEFINITIONS (including list_metrics) when listing available tools.
    return {
      tools: TOOL_DEFINITIONS,
  • Instantiation of the SegmentMetricHandlers class instance used by the list_metrics tool.
    this.segmentMetricHandlers = new SegmentMetricHandlers(this.apiClient);
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden and does well by explicitly stating 'Risk: None - read-only operation' and marking it as '[SAFE]'. It discloses the behavioral trait of being read-only, which is crucial for a tool with no parameters and no output schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with key information (purpose and safety), uses emojis and formatting effectively, and every sentence adds value without waste. It is appropriately sized for a simple list tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is complete enough by explaining what metrics are and the read-only nature. However, it lacks details on return format or pagination, which could be helpful but is not critical for this low-complexity tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so the schema fully documents the inputs. The description adds no parameter details, which is appropriate here. Baseline is 4 for 0 parameters, as it doesn't need to compensate for any gaps.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('List') and resource ('all metrics (saved aggregations) in Metabase'), with specific examples ('Total Revenue', 'Average Order Value') that help distinguish it from sibling tools like list_cards or list_dashboards. It precisely defines what metrics are in this context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool ('List all metrics') and implies usage for retrieving reusable calculations. However, it does not explicitly state when not to use it or name alternatives among siblings (e.g., list_cards for other saved items), though the specificity helps differentiate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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