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
| Name | Required | Description | Default |
|---|---|---|---|
| fieldId | Yes | The 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'], }, },
- src/server/MetabaseMCPServer.js:210-211 (registration)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);
- src/server/MetabaseMCPServer.js:42-42 (registration)Instantiation of the FieldHandlers class, which provides the getField method used by the tool.this.fieldHandlers = new FieldHandlers(this.apiClient);
- src/server/MetabaseMCPServer.js:14-14 (registration)Import of the FieldHandlers module containing the getField handler.import { FieldHandlers } from './handlers/fieldHandlers.js';