get_dataverse_column
Retrieve detailed information about a specific column in a Dataverse table, including data type, properties, and configuration settings to inspect column definitions and understand field structure.
Instructions
Retrieves detailed information about a specific column in a Dataverse table, including its data type, properties, and configuration settings. Use this to inspect column definitions and understand field structure.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| entityLogicalName | Yes | Logical name of the table | |
| logicalName | Yes | Logical name of the column to retrieve |
Implementation Reference
- src/tools/column-tools.ts:282-342 (handler)Handler function that fetches the column metadata from Dataverse, enhances it for lookup attributes by querying relationships to find the navigation property name, and returns formatted details or error.async (params) => { try { // Retrieve the base attribute metadata const attribute = await client.getMetadata<AttributeMetadata>( `EntityDefinitions(LogicalName='${params.entityLogicalName}')/Attributes(LogicalName='${params.logicalName}')` ); // Prepare enhanced payload that can include navigationProperty when applicable const enhanced: any = { ...attribute }; // Determine if this is a Lookup attribute using multiple heuristics for robustness const attrType: any = (attribute as any)?.AttributeType; const odataType: string | undefined = (attribute as any)?.["@odata.type"]; const isLookup = (typeof attrType === "string" && attrType.toLowerCase() === "lookup") || (typeof attrType === "number" && attrType === 6) || // AttributeTypeCode.Lookup (typeof odataType === "string" && odataType.toLowerCase().includes("lookupattributemetadata")); if (isLookup) { try { // Query ManyToOneRelationships for this entity to map ReferencingAttribute -> ReferencingEntityNavigationPropertyName const relationshipsUrl = `EntityDefinitions(LogicalName='${params.entityLogicalName}')/ManyToOneRelationships?$select=ReferencingAttribute,ReferencingEntityNavigationPropertyName`; const relationshipsResponse: any = await client.getMetadata(relationshipsUrl); // Find the relationship entry that matches the current attribute logical name const match = relationshipsResponse?.value?.find( (rel: any) => typeof rel?.ReferencingAttribute === "string" && rel.ReferencingAttribute.toLowerCase() === params.logicalName.toLowerCase() ); if (match?.ReferencingEntityNavigationPropertyName) { enhanced.navigationProperty = match.ReferencingEntityNavigationPropertyName; } } catch (relError) { // Do not fail the tool for relationship lookup issues; just omit navigationProperty } } return { content: [ { type: "text", text: `Column information for '${params.logicalName}' in table '${params.entityLogicalName}':\n\n${JSON.stringify(enhanced, null, 2)}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error retrieving column: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } }
- src/tools/column-tools.ts:277-280 (schema)Zod input schema defining the required parameters: entityLogicalName and logicalName.inputSchema: { entityLogicalName: z.string().describe("Logical name of the table"), logicalName: z.string().describe("Logical name of the column to retrieve") }
- src/tools/column-tools.ts:272-344 (registration)Tool registration call within the exported getColumnTool function, specifying the tool name, metadata (title, description, schema), and handler.server.registerTool( "get_dataverse_column", { title: "Get Dataverse Column", description: "Retrieves detailed information about a specific column in a Dataverse table, including its data type, properties, and configuration settings. Use this to inspect column definitions and understand field structure.", inputSchema: { entityLogicalName: z.string().describe("Logical name of the table"), logicalName: z.string().describe("Logical name of the column to retrieve") } }, async (params) => { try { // Retrieve the base attribute metadata const attribute = await client.getMetadata<AttributeMetadata>( `EntityDefinitions(LogicalName='${params.entityLogicalName}')/Attributes(LogicalName='${params.logicalName}')` ); // Prepare enhanced payload that can include navigationProperty when applicable const enhanced: any = { ...attribute }; // Determine if this is a Lookup attribute using multiple heuristics for robustness const attrType: any = (attribute as any)?.AttributeType; const odataType: string | undefined = (attribute as any)?.["@odata.type"]; const isLookup = (typeof attrType === "string" && attrType.toLowerCase() === "lookup") || (typeof attrType === "number" && attrType === 6) || // AttributeTypeCode.Lookup (typeof odataType === "string" && odataType.toLowerCase().includes("lookupattributemetadata")); if (isLookup) { try { // Query ManyToOneRelationships for this entity to map ReferencingAttribute -> ReferencingEntityNavigationPropertyName const relationshipsUrl = `EntityDefinitions(LogicalName='${params.entityLogicalName}')/ManyToOneRelationships?$select=ReferencingAttribute,ReferencingEntityNavigationPropertyName`; const relationshipsResponse: any = await client.getMetadata(relationshipsUrl); // Find the relationship entry that matches the current attribute logical name const match = relationshipsResponse?.value?.find( (rel: any) => typeof rel?.ReferencingAttribute === "string" && rel.ReferencingAttribute.toLowerCase() === params.logicalName.toLowerCase() ); if (match?.ReferencingEntityNavigationPropertyName) { enhanced.navigationProperty = match.ReferencingEntityNavigationPropertyName; } } catch (relError) { // Do not fail the tool for relationship lookup issues; just omit navigationProperty } } return { content: [ { type: "text", text: `Column information for '${params.logicalName}' in table '${params.entityLogicalName}':\n\n${JSON.stringify(enhanced, null, 2)}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error retrieving column: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } } ); }