Skip to main content
Glama
mwhesse

Dataverse MCP Server

by mwhesse

Update Dataverse Column

update_dataverse_column

Modify column properties in Dataverse tables, including display names, descriptions, required levels, and audit settings to adapt to changing business requirements.

Instructions

Updates the properties and configuration of an existing column in a Dataverse table. Use this to modify column settings like display names, descriptions, required levels, or audit settings. Note that data type cannot be changed after creation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionNoNew description of the column
displayNameNoNew display name for the column
entityLogicalNameYesLogical name of the table
isAuditEnabledNoWhether auditing is enabled for this column
isValidForAdvancedFindNoWhether the column appears in Advanced Find
isValidForCreateNoWhether the column can be set during create
isValidForUpdateNoWhether the column can be updated
logicalNameYesLogical name of the column to update
requiredLevelNoNew required level of the column

Implementation Reference

  • The updateColumnTool function registers the 'update_dataverse_column' tool with the MCP server, including schema and handler.
    export function updateColumnTool(server: McpServer, client: DataverseClient) {
      server.registerTool(
        "update_dataverse_column",
        {
          title: "Update Dataverse Column",
          description: "Updates the properties and configuration of an existing column in a Dataverse table. Use this to modify column settings like display names, descriptions, required levels, or audit settings. Note that data type cannot be changed after creation.",
          inputSchema: {
            entityLogicalName: z.string().describe("Logical name of the table"),
            logicalName: z.string().describe("Logical name of the column to update"),
            displayName: z.string().optional().describe("New display name for the column"),
            description: z.string().optional().describe("New description of the column"),
            requiredLevel: z.enum(["None", "SystemRequired", "ApplicationRequired", "Recommended"]).optional().describe("New required level of the column"),
            isAuditEnabled: z.boolean().optional().describe("Whether auditing is enabled for this column"),
            isValidForAdvancedFind: z.boolean().optional().describe("Whether the column appears in Advanced Find"),
            isValidForCreate: z.boolean().optional().describe("Whether the column can be set during create"),
            isValidForUpdate: z.boolean().optional().describe("Whether the column can be updated")
          }
        },
        async (params) => {
          try {
            // First, retrieve the current attribute definition
            const currentAttribute = await client.getMetadata<AttributeMetadata>(
              `EntityDefinitions(LogicalName='${params.entityLogicalName}')/Attributes(LogicalName='${params.logicalName}')`
            );
    
            // Create the updated attribute definition by merging current with new values
            const updatedAttribute: any = {
              ...currentAttribute,
              "@odata.type": currentAttribute["@odata.type"]
            };
    
            // Update only the specified properties
            if (params.displayName) {
              updatedAttribute.DisplayName = createLocalizedLabel(params.displayName);
            }
            if (params.description) {
              updatedAttribute.Description = createLocalizedLabel(params.description);
            }
            if (params.requiredLevel) {
              updatedAttribute.RequiredLevel = {
                Value: params.requiredLevel,
                CanBeChanged: true,
                ManagedPropertyLogicalName: "canmodifyrequirementlevelsettings"
              };
            }
            if (params.isAuditEnabled !== undefined) {
              updatedAttribute.IsAuditEnabled = {
                Value: params.isAuditEnabled,
                CanBeChanged: true,
                ManagedPropertyLogicalName: "canmodifyauditsettings"
              };
            }
            if (params.isValidForAdvancedFind !== undefined) {
              updatedAttribute.IsValidForAdvancedFind = params.isValidForAdvancedFind;
            }
            if (params.isValidForCreate !== undefined) {
              updatedAttribute.IsValidForCreate = params.isValidForCreate;
            }
            if (params.isValidForUpdate !== undefined) {
              updatedAttribute.IsValidForUpdate = params.isValidForUpdate;
            }
    
            // Use PUT method with MSCRM.MergeLabels header as per Microsoft documentation
            await client.putMetadata(
              `EntityDefinitions(LogicalName='${params.entityLogicalName}')/Attributes(LogicalName='${params.logicalName}')`,
              updatedAttribute,
              {
                'MSCRM.MergeLabels': 'true'
              }
            );
    
            return {
              content: [
                {
                  type: "text",
                  text: `Successfully updated column '${params.logicalName}' in table '${params.entityLogicalName}'.`
                }
              ]
            };
          } catch (error) {
            return {
              content: [
                {
                  type: "text",
                  text: `Error updating column: ${error instanceof Error ? error.message : 'Unknown error'}`
                }
              ],
              isError: true
            };
          }
        }
      );
    }
  • The asynchronous handler function that fetches the current column metadata, applies the provided updates to properties like display name, description, required level, etc., and performs the PUT request to update the column in Dataverse.
    async (params) => {
      try {
        // First, retrieve the current attribute definition
        const currentAttribute = await client.getMetadata<AttributeMetadata>(
          `EntityDefinitions(LogicalName='${params.entityLogicalName}')/Attributes(LogicalName='${params.logicalName}')`
        );
    
        // Create the updated attribute definition by merging current with new values
        const updatedAttribute: any = {
          ...currentAttribute,
          "@odata.type": currentAttribute["@odata.type"]
        };
    
        // Update only the specified properties
        if (params.displayName) {
          updatedAttribute.DisplayName = createLocalizedLabel(params.displayName);
        }
        if (params.description) {
          updatedAttribute.Description = createLocalizedLabel(params.description);
        }
        if (params.requiredLevel) {
          updatedAttribute.RequiredLevel = {
            Value: params.requiredLevel,
            CanBeChanged: true,
            ManagedPropertyLogicalName: "canmodifyrequirementlevelsettings"
          };
        }
        if (params.isAuditEnabled !== undefined) {
          updatedAttribute.IsAuditEnabled = {
            Value: params.isAuditEnabled,
            CanBeChanged: true,
            ManagedPropertyLogicalName: "canmodifyauditsettings"
          };
        }
        if (params.isValidForAdvancedFind !== undefined) {
          updatedAttribute.IsValidForAdvancedFind = params.isValidForAdvancedFind;
        }
        if (params.isValidForCreate !== undefined) {
          updatedAttribute.IsValidForCreate = params.isValidForCreate;
        }
        if (params.isValidForUpdate !== undefined) {
          updatedAttribute.IsValidForUpdate = params.isValidForUpdate;
        }
    
        // Use PUT method with MSCRM.MergeLabels header as per Microsoft documentation
        await client.putMetadata(
          `EntityDefinitions(LogicalName='${params.entityLogicalName}')/Attributes(LogicalName='${params.logicalName}')`,
          updatedAttribute,
          {
            'MSCRM.MergeLabels': 'true'
          }
        );
    
        return {
          content: [
            {
              type: "text",
              text: `Successfully updated column '${params.logicalName}' in table '${params.entityLogicalName}'.`
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error updating column: ${error instanceof Error ? error.message : 'Unknown error'}`
            }
          ],
          isError: true
        };
      }
    }
  • Zod input schema defining the parameters for updating a Dataverse column, including entity logical name, column logical name, and optional updatable properties.
    inputSchema: {
      entityLogicalName: z.string().describe("Logical name of the table"),
      logicalName: z.string().describe("Logical name of the column to update"),
      displayName: z.string().optional().describe("New display name for the column"),
      description: z.string().optional().describe("New description of the column"),
      requiredLevel: z.enum(["None", "SystemRequired", "ApplicationRequired", "Recommended"]).optional().describe("New required level of the column"),
      isAuditEnabled: z.boolean().optional().describe("Whether auditing is enabled for this column"),
      isValidForAdvancedFind: z.boolean().optional().describe("Whether the column appears in Advanced Find"),
      isValidForCreate: z.boolean().optional().describe("Whether the column can be set during create"),
      isValidForUpdate: z.boolean().optional().describe("Whether the column can be updated")
    }
  • Helper function to create localized label objects used in the update handler for DisplayName and Description properties.
    function createLocalizedLabel(text: string, languageCode: number = 1033): LocalizedLabel {
      return {
        LocalizedLabels: [
          {
            Label: text,
            LanguageCode: languageCode,
            IsManaged: false,
            MetadataId: "00000000-0000-0000-0000-000000000000"
          }
        ],
        UserLocalizedLabel: {
          Label: text,
          LanguageCode: languageCode,
          IsManaged: false,
          MetadataId: "00000000-0000-0000-0000-000000000000"
        }
      };
Behavior3/5

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

With no annotations provided, the description carries full burden. It discloses the important constraint that 'data type cannot be changed after creation' which is valuable behavioral context. However, it doesn't mention permission requirements, whether changes are reversible, error conditions, or what happens to existing data when settings change. For a mutation tool with zero annotation coverage, this leaves significant behavioral gaps.

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 perfectly concise with only two sentences. The first sentence states the purpose and scope, the second adds crucial behavioral constraint. Every word earns its place with zero redundancy or fluff.

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?

For a mutation tool with 9 parameters, no annotations, and no output schema, the description is adequate but incomplete. It covers the core purpose and one important constraint, but doesn't address permission requirements, error handling, or what the tool returns. Given the complexity and lack of structured metadata, it should provide more behavioral context.

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 all 9 parameters thoroughly. The description mentions 'display names, descriptions, required levels, or audit settings' which maps to some parameters, but doesn't add meaningful semantic context beyond what's in the schema. The baseline of 3 is appropriate when the schema does the heavy lifting.

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 ('Updates the properties and configuration'), target resource ('an existing column in a Dataverse table'), and scope ('modify column settings like display names, descriptions, required levels, or audit settings'). It distinguishes from sibling tools like 'create_dataverse_column' by specifying it's for existing columns only.

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 modify column settings'), but doesn't explicitly state when not to use it or name specific alternatives. It mentions 'data type cannot be changed after creation' which implies this isn't for data type changes, but doesn't specify what tool to use instead for such cases.

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