Skip to main content
Glama
MikelA92

Metabase MCP Server

by MikelA92

get_field

Retrieve detailed metadata about a specific database field, including its data type, description, and column information to understand data structure.

Instructions

๐Ÿ” [SAFE] Get detailed information about a specific field/column including its type, description, and metadata. Use this to understand what a column contains. Risk: None - read-only operation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fieldIdYesThe ID of the field

Implementation Reference

  • The main handler function that implements the logic for the 'get_field' tool. Validates input, fetches field details from Metabase API, and returns formatted MCP content.
      async getField(fieldId) {
        Validators.validateFieldId(fieldId);
        
        this.logger.debug('Getting field', { fieldId });
        const field = await this.apiClient.makeRequest(`/api/field/${fieldId}`);
        
        return {
          content: [
            {
              type: 'text',
              text: `Field Information:
    ID: ${field.id}
    Name: ${field.name}
    Display Name: ${field.display_name}
    Type: ${field.base_type}
    Semantic Type: ${field.semantic_type || 'None'}
    Description: ${field.description || 'No description'}
    Table: ${field.table?.name}`,
            },
          ],
        };
      }
  • The tool schema definition for 'get_field', including input schema with fieldId parameter validation.
    {
      name: 'get_field',
      description: '๐Ÿ” [SAFE] Get detailed information about a specific field/column including its type, description, and metadata. Use this to understand what a column contains. Risk: None - read-only operation.',
      inputSchema: {
        type: 'object',
        properties: {
          fieldId: {
            type: 'integer',
            description: 'The ID of the field',
            minimum: 1,
          },
        },
        required: ['fieldId'],
      },
    },
  • Registration of the 'get_field' tool in the MCP server's executeTool switch statement, dispatching to the fieldHandlers instance.
    case 'get_field':
      return await this.fieldHandlers.getField(args.fieldId);
  • Instantiation of the FieldHandlers class, which provides the getField method used by the tool.
    this.fieldHandlers = new FieldHandlers(this.apiClient);
  • Import of the FieldHandlers module containing the getField handler.
    import { FieldHandlers } from './handlers/fieldHandlers.js';

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