Skip to main content
Glama
mwhesse

Dataverse MCP Server

by mwhesse

get_autonumber_column

Retrieve detailed information about an AutoNumber column configuration including current format, properties, and settings in Microsoft Dataverse tables.

Instructions

Retrieves detailed information about an AutoNumber column including its current format, properties, and configuration.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
columnLogicalNameYesLogical name of the AutoNumber column to retrieve
entityLogicalNameYesLogical name of the table

Implementation Reference

  • The main handler function that executes the tool logic: fetches column metadata via Dataverse API, validates it's an AutoNumber column, extracts properties like format, maxLength, etc., and returns structured information or error response.
    async (params) => { try { const column = await client.getMetadata( `EntityDefinitions(LogicalName='${params.entityLogicalName}')/Attributes(LogicalName='${params.columnLogicalName}')` ); // Check if it's an AutoNumber column if (column.AttributeType !== 'String' || !column.AutoNumberFormat) { return { content: [ { type: "text", text: `The specified column '${params.columnLogicalName}' is not an AutoNumber column.\n\nAttribute Type: ${column.AttributeType}\nHas AutoNumber Format: ${!!column.AutoNumberFormat}` } ], isError: true }; } const columnInfo = { logicalName: column.LogicalName, schemaName: column.SchemaName, displayName: column.DisplayName?.UserLocalizedLabel?.Label || column.DisplayName?.LocalizedLabels?.[0]?.Label, description: column.Description?.UserLocalizedLabel?.Label || column.Description?.LocalizedLabels?.[0]?.Label, autoNumberFormat: column.AutoNumberFormat, attributeType: column.AttributeType, format: column.Format, maxLength: column.MaxLength, requiredLevel: column.RequiredLevel?.Value, isAuditEnabled: column.IsAuditEnabled?.Value, isValidForAdvancedFind: column.IsValidForAdvancedFind?.Value, isValidForCreate: column.IsValidForCreate?.Value, isValidForUpdate: column.IsValidForUpdate?.Value, isCustomAttribute: column.IsCustomAttribute?.Value, isManaged: column.IsManaged?.Value, metadataId: column.MetadataId }; return { content: [ { type: "text", text: `AutoNumber column information for '${params.columnLogicalName}' in table '${params.entityLogicalName}':\n\n${JSON.stringify(columnInfo, null, 2)}` } ] }; } catch (error: any) { return { content: [ { type: "text", text: `Error retrieving AutoNumber column: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } }
  • Input schema definition for the tool, specifying required parameters: entityLogicalName and columnLogicalName using Zod validation.
    { title: 'Get AutoNumber Column', description: 'Retrieves detailed information about an AutoNumber column including its current format, properties, and configuration.', inputSchema: { entityLogicalName: z.string().describe('Logical name of the table'), columnLogicalName: z.string().describe('Logical name of the AutoNumber column to retrieve') } },
  • Registration function that calls server.registerTool to add the 'get_autonumber_column' tool with its schema and handler.
    export function getAutoNumberColumnTool(server: McpServer, client: DataverseClient) { server.registerTool( 'get_autonumber_column', { title: 'Get AutoNumber Column', description: 'Retrieves detailed information about an AutoNumber column including its current format, properties, and configuration.', inputSchema: { entityLogicalName: z.string().describe('Logical name of the table'), columnLogicalName: z.string().describe('Logical name of the AutoNumber column to retrieve') } }, async (params) => { try { const column = await client.getMetadata( `EntityDefinitions(LogicalName='${params.entityLogicalName}')/Attributes(LogicalName='${params.columnLogicalName}')` ); // Check if it's an AutoNumber column if (column.AttributeType !== 'String' || !column.AutoNumberFormat) { return { content: [ { type: "text", text: `The specified column '${params.columnLogicalName}' is not an AutoNumber column.\n\nAttribute Type: ${column.AttributeType}\nHas AutoNumber Format: ${!!column.AutoNumberFormat}` } ], isError: true }; } const columnInfo = { logicalName: column.LogicalName, schemaName: column.SchemaName, displayName: column.DisplayName?.UserLocalizedLabel?.Label || column.DisplayName?.LocalizedLabels?.[0]?.Label, description: column.Description?.UserLocalizedLabel?.Label || column.Description?.LocalizedLabels?.[0]?.Label, autoNumberFormat: column.AutoNumberFormat, attributeType: column.AttributeType, format: column.Format, maxLength: column.MaxLength, requiredLevel: column.RequiredLevel?.Value, isAuditEnabled: column.IsAuditEnabled?.Value, isValidForAdvancedFind: column.IsValidForAdvancedFind?.Value, isValidForCreate: column.IsValidForCreate?.Value, isValidForUpdate: column.IsValidForUpdate?.Value, isCustomAttribute: column.IsCustomAttribute?.Value, isManaged: column.IsManaged?.Value, metadataId: column.MetadataId }; return { content: [ { type: "text", text: `AutoNumber column information for '${params.columnLogicalName}' in table '${params.entityLogicalName}':\n\n${JSON.stringify(columnInfo, null, 2)}` } ] }; } catch (error: any) { return { content: [ { type: "text", text: `Error retrieving AutoNumber column: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } } ); }
  • src/index.ts:243-243 (registration)
    Top-level call to register the getAutoNumberColumnTool during MCP server initialization.
    getAutoNumberColumnTool(server, dataverseClient);

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