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
| Name | Required | Description | Default |
|---|---|---|---|
| description | No | New description of the column | |
| displayName | No | New display name for the column | |
| entityLogicalName | Yes | Logical name of the table | |
| isAuditEnabled | No | Whether auditing is enabled for this column | |
| isValidForAdvancedFind | No | Whether the column appears in Advanced Find | |
| isValidForCreate | No | Whether the column can be set during create | |
| isValidForUpdate | No | Whether the column can be updated | |
| logicalName | Yes | Logical name of the column to update | |
| requiredLevel | No | New required level of the column |
Implementation Reference
- src/tools/column-tools.ts:346-438 (registration)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 }; } } ); }
- src/tools/column-tools.ts:364-436 (handler)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 }; } }
- src/tools/column-tools.ts:352-362 (schema)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") }
- src/tools/column-tools.ts:7-23 (helper)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" } };