Skip to main content
Glama
mwhesse

Dataverse MCP Server

by mwhesse

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" } };

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