Skip to main content
Glama
MikelA92
by MikelA92

get_field_values

Retrieve distinct values from a database field to understand what data exists in a specific column, useful for data exploration and 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 main handler function in FieldHandlers class that executes the get_field_values tool: validates fieldId, fetches values from Metabase API `/api/field/${fieldId}/values`, formats the distinct values into a text response limited to first 100.
    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'}`, }, ], }; }
  • Tool schema definition including name, description, and inputSchema requiring integer fieldId >=1.
    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'], }, },
  • Registration/dispatch in MetabaseMCPServer.executeTool switch statement: maps tool name to fieldHandlers.getFieldValues.
    case 'get_field_values': return await this.fieldHandlers.getFieldValues(args.fieldId);
  • Supporting MetabaseClient method that performs the actual API request to fetch field values, used by the handler via apiClient.
    async getFieldValues(fieldId) { Validators.validateFieldId(fieldId); const values = await this.makeRequest(`/api/field/${fieldId}/values`); return values.values || []; }

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