get_field
Retrieve detailed metadata about a specific database column including its data type, description, and field properties to understand column contents and 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 handler function getField that implements the core logic of the 'get_field' tool. It validates the fieldId, fetches the field data from the Metabase API, formats it into a text response, and returns it in the MCP content format.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 schema definition for the 'get_field' tool, including name, description, and inputSchema specifying the required fieldId parameter.{ 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)The registration/dispatch point in the executeTool method where 'get_field' tool calls are routed to the fieldHandlers.getField method.case 'get_field': return await this.fieldHandlers.getField(args.fieldId);
- src/server/MetabaseMCPServer.js:129-134 (registration)The tool list handler that returns TOOL_DEFINITIONS, which includes the 'get_field' tool schema for MCP clients to discover available tools.this.server.setRequestHandler(ListToolsRequestSchema, async () => { this.logger.debug('Listing tools'); return { tools: TOOL_DEFINITIONS, }; });
- src/server/MetabaseMCPServer.js:42-42 (registration)Instantiation of the FieldHandlers class instance used by the 'get_field' tool.this.fieldHandlers = new FieldHandlers(this.apiClient);