Skip to main content
Glama
mwhesse

Dataverse MCP Server

by mwhesse

Get AutoNumber Column

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);
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It implies a read-only operation ('retrieves') but doesn't disclose error conditions (e.g., if the column doesn't exist), rate limits, authentication requirements, or the format/structure of the returned information. This leaves significant gaps for an agent to understand tool behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action ('retrieves detailed information') and specifies the scope ('about an AutoNumber column'). It avoids redundancy but could be slightly more structured by explicitly separating purpose from output details.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with no annotations and no output schema, the description is insufficient. It doesn't explain what 'detailed information' includes beyond high-level categories, how results are formatted, or potential errors. Given the complexity of retrieving configuration data, more context is needed to guide an agent effectively.

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%, with both parameters clearly documented in the schema itself. The description adds no additional parameter semantics beyond what the schema provides (e.g., it doesn't clarify what 'logical name' means or provide examples). Baseline 3 is appropriate since the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('retrieves') and resource ('detailed information about an AutoNumber column'), specifying what properties are included (format, properties, configuration). It distinguishes from 'list_autonumber_columns' by focusing on a single column's details rather than listing multiple columns, though this distinction could be more explicit.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'list_autonumber_columns' or 'get_dataverse_column'. It doesn't mention prerequisites, such as needing to know the column's logical name beforehand, or contextual factors like permissions required.

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