Skip to main content
Glama
mwhesse

Dataverse MCP Server

by mwhesse

Get Dataverse Column

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
NameRequiredDescriptionDefault
entityLogicalNameYesLogical name of the table
logicalNameYesLogical name of the column to retrieve

Implementation Reference

  • 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
        };
      }
    }
  • 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")
    }
  • 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
            };
          }
        }
      );
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It describes the tool as a retrieval operation ('Retrieves detailed information'), which correctly implies it's a read-only operation. However, it doesn't disclose behavioral traits like authentication requirements, rate limits, error conditions, or response format details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured in two sentences: the first states the purpose and scope, the second provides usage guidance. Every sentence adds value with zero wasted words, making it appropriately sized and front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (retrieving detailed column information), no annotations, and no output schema, the description is adequate but incomplete. It explains what the tool does and when to use it, but lacks details on return values, error handling, or behavioral constraints that would be helpful for an agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters ('entityLogicalName' and 'logicalName') with clear descriptions. The description adds no additional parameter semantics beyond what the schema provides, maintaining the baseline score of 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Retrieves detailed information'), resource ('a specific column in a Dataverse table'), and scope ('including its data type, properties, and configuration settings'). It distinguishes from sibling tools like 'list_dataverse_columns' by focusing on a single column's details rather than listing multiple columns.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool ('to inspect column definitions and understand field structure'), but does not explicitly mention when not to use it or name alternatives. It implies usage for detailed inspection rather than listing, which helps differentiate from 'list_dataverse_columns'.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/mwhesse/mcp-dataverse'

If you have feedback or need assistance with the MCP directory API, please join our Discord server