Skip to main content
Glama
MikelA92

Metabase MCP Server

by MikelA92

get_field_values

Retrieve distinct values from a Metabase field to understand column data content and identify available options for analysis.

Instructions

🔍 [SAFE] Get distinct values for a field (useful for understanding what values exist in a column). May return many values for high-cardinality fields. Risk: None - read-only, but may return large results.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fieldIdYesThe ID of the field

Implementation Reference

  • The primary handler function for the 'get_field_values' MCP tool. It validates the fieldId, fetches distinct values from the Metabase API endpoint `/api/field/${fieldId}/values`, limits display to first 100 values, and returns a formatted MCP response.
      async getFieldValues(fieldId) {
        Validators.validateFieldId(fieldId);
        
        this.logger.debug('Getting field values', { fieldId });
        const values = await this.apiClient.makeRequest(`/api/field/${fieldId}/values`);
        
        const distinctValues = values.values || [];
        
        return {
          content: [
            {
              type: 'text',
              text: `Field Values (ID: ${fieldId}):
    Total Distinct Values: ${distinctValues.length}
    
    ${distinctValues.length > 0 ? `Values:\n${distinctValues.slice(0, 100).join(', ')}${distinctValues.length > 100 ? `\n... and ${distinctValues.length - 100} more values` : ''}` : 'No values found'}`,
            },
          ],
        };
      }
  • The tool schema definition including name, description, and input validation schema requiring a single integer 'fieldId' parameter.
    {
      name: 'get_field_values',
      description: '🔍 [SAFE] Get distinct values for a field (useful for understanding what values exist in a column). May return many values for high-cardinality fields. Risk: None - read-only, but may return large results.',
      inputSchema: {
        type: 'object',
        properties: {
          fieldId: {
            type: 'integer',
            description: 'The ID of the field',
            minimum: 1,
          },
        },
        required: ['fieldId'],
      },
    },
  • The tool dispatch/registration in the MCP server's executeTool method switch statement, which routes calls to the FieldHandlers.getFieldValues method.
    case 'get_field_values':
      return await this.fieldHandlers.getFieldValues(args.fieldId);
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 so effectively. It discloses key behavioral traits: the operation is read-only and safe ('[SAFE]', 'Risk: None - read-only'), potential performance considerations ('may return large results'), and a specific use case for high-cardinality fields. It does not cover aspects like rate limits or authentication needs, but provides sufficient context for a read operation.

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 the core purpose, followed by usage context and risk information in three concise sentences. Every sentence adds value: the first states the action, the second provides usage guidance, and the third addresses safety and performance. No wasted words or redundancy.

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?

For a simple read tool with one parameter and no output schema, the description is largely complete. It covers purpose, usage, safety, and performance considerations. However, it lacks details on output format (e.g., structure of returned values) and any pagination or limits, which would be helpful given the mention of 'large results'.

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

Parameters3/5

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

The input schema has 100% description coverage, with fieldId documented as 'The ID of the field'. The description adds no additional parameter semantics beyond implying the field relates to a 'column', which is redundant with the schema. Baseline score of 3 is appropriate as the schema fully covers parameter meaning.

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 action ('Get distinct values for a field') and resource ('a field'), distinguishing it from siblings like get_field (which retrieves field metadata) or execute_query_builder_card (which runs queries). It explicitly mentions the purpose is 'useful for understanding what values exist in a column,' providing clear differentiation.

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 ('useful for understanding what values exist in a column') and mentions a specific scenario ('May return many values for high-cardinality fields'). However, it does not explicitly state when not to use it or name alternatives among the sibling tools, such as execute_native_query for more complex filtering.

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