Skip to main content
Glama
MikelA92

Metabase MCP Server

by MikelA92

list_segments

Retrieve all saved filter segments from Metabase, such as 'Active Users' or 'Premium Customers', for reuse in queries and analysis.

Instructions

🎯 [SAFE] List all segments (saved filters) in Metabase. Segments are reusable filters like "Active Users" or "Premium Customers". Risk: None - read-only operation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function that implements the list_segments tool. It fetches all segments from the Metabase API endpoint '/api/segment' and formats them into a markdown-style text response listing ID, name, table, and description for each segment.
      async listSegments() {
        this.logger.debug('Listing segments');
        const segments = await this.apiClient.makeRequest('/api/segment');
        
        return {
          content: [
            {
              type: 'text',
              text: `Segments:
    ${segments.map(s => 
      `- ID: ${s.id} | Name: ${s.name} | Table: ${s.table?.name}${s.description ? ` | ${s.description}` : ''}`
    ).join('\n')}`,
            },
          ],
        };
      }
  • The tool schema definition specifying the name 'list_segments', its description, and an empty input schema (no parameters required). This is used for tool listing and validation.
      name: 'list_segments',
      description: '🎯 [SAFE] List all segments (saved filters) in Metabase. Segments are reusable filters like "Active Users" or "Premium Customers". Risk: None - read-only operation.',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • The switch case in the tool execution dispatcher that maps the 'list_segments' tool call to the SegmentMetricHandlers.listSegments() method.
    case 'list_segments':
      return await this.segmentMetricHandlers.listSegments();
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 of behavioral disclosure. It explicitly states 'Risk: None - read-only operation', which clearly indicates safety and non-destructive behavior. It also adds context by describing segments as 'saved filters', though it lacks details on output format or pagination.

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, safety, examples) in three concise sentences with zero waste. Each sentence earns its place: the first states the action, the second explains segments, and the third addresses risk.

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 low complexity (0 parameters, no output schema, no annotations), the description is mostly complete by covering purpose, examples, and safety. However, it lacks details on the return format (e.g., list structure or fields), which could be helpful for an agent despite the simplicity.

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 input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description does not mention any parameters, which is appropriate. A baseline of 4 is given as it compensates adequately for the lack of parameters by focusing on the tool's purpose and behavior.

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 specific verb ('List all') and resource ('segments (saved filters) in Metabase'), with examples ('Active Users', 'Premium Customers') that concretely illustrate what segments are. It distinguishes itself from sibling tools like list_cards or list_dashboards by specifying the exact resource type.

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 by explaining that segments are 'reusable filters' and listing examples, which helps an agent understand when this tool is appropriate. However, it does not explicitly state when not to use it or name alternatives (e.g., for non-saved filters or other list operations), missing full explicit guidance.

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