Skip to main content
Glama
mwhesse

Dataverse MCP Server

by mwhesse

update_dataverse_table

Modify existing Dataverse table properties including display names, descriptions, and feature settings like activities, notes, auditing, and duplicate detection.

Instructions

Updates the properties and configuration of an existing Dataverse table. Use this to modify table settings like display names, descriptions, or feature enablement (activities, notes, auditing, etc.). Changes are published automatically.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionNoNew description of the table
displayCollectionNameNoNew display collection name for the table
displayNameNoNew display name for the table
hasActivitiesNoWhether the table can have activities
hasNotesNoWhether the table can have notes
isAuditEnabledNoWhether auditing is enabled
isConnectionsEnabledNoWhether connections are enabled
isDocumentManagementEnabledNoWhether document management is enabled
isDuplicateDetectionEnabledNoWhether duplicate detection is enabled
isMailMergeEnabledNoWhether mail merge is enabled
isValidForQueueNoWhether records can be added to queues
logicalNameYesLogical name of the table to update

Implementation Reference

  • Executes the tool logic: Retrieves existing table metadata, merges provided updates for display names, descriptions, and feature flags (activities, notes, audit, etc.), performs a PUT request with MSCRM.MergeLabels header to update labels safely, publishes the customization, and returns success or error response.
    async (params) => { try { // First, retrieve the current entity definition const currentEntity = await client.getMetadata<EntityMetadata>( `EntityDefinitions(LogicalName='${params.logicalName}')` ); // Create the updated entity definition by merging current with new values const updatedEntity: any = { ...currentEntity, "@odata.type": "Microsoft.Dynamics.CRM.EntityMetadata" }; // Update only the specified properties if (params.displayName) { updatedEntity.DisplayName = createLocalizedLabel(params.displayName); } if (params.displayCollectionName) { updatedEntity.DisplayCollectionName = createLocalizedLabel(params.displayCollectionName); } if (params.description) { updatedEntity.Description = createLocalizedLabel(params.description); } if (params.hasActivities !== undefined) { updatedEntity.HasActivities = params.hasActivities; } if (params.hasNotes !== undefined) { updatedEntity.HasNotes = params.hasNotes; } if (params.isAuditEnabled !== undefined) { updatedEntity.IsAuditEnabled = { Value: params.isAuditEnabled, CanBeChanged: true, ManagedPropertyLogicalName: "canmodifyauditsettings" }; } if (params.isDuplicateDetectionEnabled !== undefined) { updatedEntity.IsDuplicateDetectionEnabled = { Value: params.isDuplicateDetectionEnabled, CanBeChanged: true, ManagedPropertyLogicalName: "canmodifyduplicatedetectionsettings" }; } if (params.isValidForQueue !== undefined) { updatedEntity.IsValidForQueue = { Value: params.isValidForQueue, CanBeChanged: true, ManagedPropertyLogicalName: "canmodifyqueuesettings" }; } if (params.isConnectionsEnabled !== undefined) { updatedEntity.IsConnectionsEnabled = { Value: params.isConnectionsEnabled, CanBeChanged: true, ManagedPropertyLogicalName: "canmodifyconnectionsettings" }; } if (params.isMailMergeEnabled !== undefined) { updatedEntity.IsMailMergeEnabled = { Value: params.isMailMergeEnabled, CanBeChanged: true, ManagedPropertyLogicalName: "canmodifymailmergesettings" }; } if (params.isDocumentManagementEnabled !== undefined) { updatedEntity.IsDocumentManagementEnabled = params.isDocumentManagementEnabled; } // Use PUT method with MSCRM.MergeLabels header as per Microsoft documentation await client.putMetadata(`EntityDefinitions(LogicalName='${params.logicalName}')`, updatedEntity, { 'MSCRM.MergeLabels': 'true' }); // Publish the changes as required by the API await client.callAction('PublishXml', { ParameterXml: `<importexportxml><entities><entity>${params.logicalName}</entity></entities></importexportxml>` }); return { content: [ { type: "text", text: `Successfully updated table '${params.logicalName}' and published changes.` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error updating table: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } }
  • Zod-based input schema defining parameters for updating table properties including logicalName (required), optional display names, description, and boolean flags for various table features.
    { title: "Update Dataverse Table", description: "Updates the properties and configuration of an existing Dataverse table. Use this to modify table settings like display names, descriptions, or feature enablement (activities, notes, auditing, etc.). Changes are published automatically.", inputSchema: { logicalName: z.string().describe("Logical name of the table to update"), displayName: z.string().optional().describe("New display name for the table"), displayCollectionName: z.string().optional().describe("New display collection name for the table"), description: z.string().optional().describe("New description of the table"), hasActivities: z.boolean().optional().describe("Whether the table can have activities"), hasNotes: z.boolean().optional().describe("Whether the table can have notes"), isAuditEnabled: z.boolean().optional().describe("Whether auditing is enabled"), isDuplicateDetectionEnabled: z.boolean().optional().describe("Whether duplicate detection is enabled"), isValidForQueue: z.boolean().optional().describe("Whether records can be added to queues"), isConnectionsEnabled: z.boolean().optional().describe("Whether connections are enabled"), isMailMergeEnabled: z.boolean().optional().describe("Whether mail merge is enabled"), isDocumentManagementEnabled: z.boolean().optional().describe("Whether document management is enabled") } },
  • Registers the 'update_dataverse_table' tool on the MCP server within the updateTableTool export function, including schema and handler.
    server.registerTool( "update_dataverse_table", { title: "Update Dataverse Table", description: "Updates the properties and configuration of an existing Dataverse table. Use this to modify table settings like display names, descriptions, or feature enablement (activities, notes, auditing, etc.). Changes are published automatically.", inputSchema: { logicalName: z.string().describe("Logical name of the table to update"), displayName: z.string().optional().describe("New display name for the table"), displayCollectionName: z.string().optional().describe("New display collection name for the table"), description: z.string().optional().describe("New description of the table"), hasActivities: z.boolean().optional().describe("Whether the table can have activities"), hasNotes: z.boolean().optional().describe("Whether the table can have notes"), isAuditEnabled: z.boolean().optional().describe("Whether auditing is enabled"), isDuplicateDetectionEnabled: z.boolean().optional().describe("Whether duplicate detection is enabled"), isValidForQueue: z.boolean().optional().describe("Whether records can be added to queues"), isConnectionsEnabled: z.boolean().optional().describe("Whether connections are enabled"), isMailMergeEnabled: z.boolean().optional().describe("Whether mail merge is enabled"), isDocumentManagementEnabled: z.boolean().optional().describe("Whether document management is enabled") } }, async (params) => { try { // First, retrieve the current entity definition const currentEntity = await client.getMetadata<EntityMetadata>( `EntityDefinitions(LogicalName='${params.logicalName}')` ); // Create the updated entity definition by merging current with new values const updatedEntity: any = { ...currentEntity, "@odata.type": "Microsoft.Dynamics.CRM.EntityMetadata" }; // Update only the specified properties if (params.displayName) { updatedEntity.DisplayName = createLocalizedLabel(params.displayName); } if (params.displayCollectionName) { updatedEntity.DisplayCollectionName = createLocalizedLabel(params.displayCollectionName); } if (params.description) { updatedEntity.Description = createLocalizedLabel(params.description); } if (params.hasActivities !== undefined) { updatedEntity.HasActivities = params.hasActivities; } if (params.hasNotes !== undefined) { updatedEntity.HasNotes = params.hasNotes; } if (params.isAuditEnabled !== undefined) { updatedEntity.IsAuditEnabled = { Value: params.isAuditEnabled, CanBeChanged: true, ManagedPropertyLogicalName: "canmodifyauditsettings" }; } if (params.isDuplicateDetectionEnabled !== undefined) { updatedEntity.IsDuplicateDetectionEnabled = { Value: params.isDuplicateDetectionEnabled, CanBeChanged: true, ManagedPropertyLogicalName: "canmodifyduplicatedetectionsettings" }; } if (params.isValidForQueue !== undefined) { updatedEntity.IsValidForQueue = { Value: params.isValidForQueue, CanBeChanged: true, ManagedPropertyLogicalName: "canmodifyqueuesettings" }; } if (params.isConnectionsEnabled !== undefined) { updatedEntity.IsConnectionsEnabled = { Value: params.isConnectionsEnabled, CanBeChanged: true, ManagedPropertyLogicalName: "canmodifyconnectionsettings" }; } if (params.isMailMergeEnabled !== undefined) { updatedEntity.IsMailMergeEnabled = { Value: params.isMailMergeEnabled, CanBeChanged: true, ManagedPropertyLogicalName: "canmodifymailmergesettings" }; } if (params.isDocumentManagementEnabled !== undefined) { updatedEntity.IsDocumentManagementEnabled = params.isDocumentManagementEnabled; } // Use PUT method with MSCRM.MergeLabels header as per Microsoft documentation await client.putMetadata(`EntityDefinitions(LogicalName='${params.logicalName}')`, updatedEntity, { 'MSCRM.MergeLabels': 'true' }); // Publish the changes as required by the API await client.callAction('PublishXml', { ParameterXml: `<importexportxml><entities><entity>${params.logicalName}</entity></entities></importexportxml>` }); return { content: [ { type: "text", text: `Successfully updated table '${params.logicalName}' and published changes.` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error updating table: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } } );
  • src/index.ts:141-141 (registration)
    Invokes updateTableTool to perform the actual registration of the tool during server initialization.
    updateTableTool(server, dataverseClient);
  • Utility function to create standardized LocalizedLabel objects used in updating DisplayName, DisplayCollectionName, and Description fields.
    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