Skip to main content
Glama
mwhesse

Dataverse MCP Server

by mwhesse

List Dataverse Columns

list_dataverse_columns

Discover available fields and table structure in Dataverse by retrieving column lists with filtering options for custom/system columns and managed/unmanaged status.

Instructions

Retrieves a list of columns in a specific Dataverse table with filtering options. Use this to discover available fields in a table, find custom columns, or get an overview of the table structure. Supports filtering by custom/system columns and managed/unmanaged status.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
customOnlyNoWhether to list only custom columns
entityLogicalNameYesLogical name of the table
filterNoOData filter expression
includeManagedNoWhether to include managed columns

Implementation Reference

  • Handler function that queries Dataverse metadata API for attributes (columns) of the specified entity, applies filters, maps to a simplified structure, and returns the list as formatted text.
    async (params) => {
      try {
        let queryParams: Record<string, any> = {
          $select: "LogicalName,DisplayName,AttributeType,AttributeTypeName,IsCustomAttribute,IsManaged,RequiredLevel,IsPrimaryId,IsPrimaryName"
        };
    
        let filters: string[] = [];
        
        if (params.customOnly) {
          filters.push("IsCustomAttribute eq true");
        }
        
        if (!params.includeManaged) {
          filters.push("IsManaged eq false");
        }
    
        if (params.filter) {
          filters.push(params.filter);
        }
    
        if (filters.length > 0) {
          queryParams.$filter = filters.join(" and ");
        }
    
        const result = await client.getMetadata<ODataResponse<AttributeMetadata>>(
          `EntityDefinitions(LogicalName='${params.entityLogicalName}')/Attributes`,
          queryParams
        );
    
        const columnList = result.value.map(attribute => ({
          logicalName: attribute.LogicalName,
          displayName: attribute.DisplayName?.UserLocalizedLabel?.Label || attribute.LogicalName,
          attributeType: attribute.AttributeType,
          attributeTypeName: attribute.AttributeTypeName?.Value || "",
          isCustom: attribute.IsCustomAttribute,
          isManaged: attribute.IsManaged,
          requiredLevel: attribute.RequiredLevel?.Value || "None",
          isPrimaryId: attribute.IsPrimaryId,
          isPrimaryName: attribute.IsPrimaryName
        }));
    
        return {
          content: [
            {
              type: "text",
              text: `Found ${columnList.length} columns in table '${params.entityLogicalName}':\n\n${JSON.stringify(columnList, null, 2)}`
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error listing columns: ${error instanceof Error ? error.message : 'Unknown error'}`
            }
          ],
          isError: true
        };
      }
  • Zod input schema defining parameters for listing columns: entity logical name, custom-only filter, include managed, and optional OData filter.
    inputSchema: {
      entityLogicalName: z.string().describe("Logical name of the table"),
      customOnly: z.boolean().default(false).describe("Whether to list only custom columns"),
      includeManaged: z.boolean().default(false).describe("Whether to include managed columns"),
      filter: z.string().optional().describe("OData filter expression")
    }
  • Tool registration function that registers 'list_dataverse_columns' with MCP server, including title, description, schema, and handler.
    export function listColumnsTool(server: McpServer, client: DataverseClient) {
      server.registerTool(
        "list_dataverse_columns",
        {
          title: "List Dataverse Columns",
          description: "Retrieves a list of columns in a specific Dataverse table with filtering options. Use this to discover available fields in a table, find custom columns, or get an overview of the table structure. Supports filtering by custom/system columns and managed/unmanaged status.",
          inputSchema: {
            entityLogicalName: z.string().describe("Logical name of the table"),
            customOnly: z.boolean().default(false).describe("Whether to list only custom columns"),
            includeManaged: z.boolean().default(false).describe("Whether to include managed columns"),
            filter: z.string().optional().describe("OData filter expression")
          }
        },
        async (params) => {
          try {
            let queryParams: Record<string, any> = {
              $select: "LogicalName,DisplayName,AttributeType,AttributeTypeName,IsCustomAttribute,IsManaged,RequiredLevel,IsPrimaryId,IsPrimaryName"
            };
    
            let filters: string[] = [];
            
            if (params.customOnly) {
              filters.push("IsCustomAttribute eq true");
            }
            
            if (!params.includeManaged) {
              filters.push("IsManaged eq false");
            }
    
            if (params.filter) {
              filters.push(params.filter);
            }
    
            if (filters.length > 0) {
              queryParams.$filter = filters.join(" and ");
            }
    
            const result = await client.getMetadata<ODataResponse<AttributeMetadata>>(
              `EntityDefinitions(LogicalName='${params.entityLogicalName}')/Attributes`,
              queryParams
            );
    
            const columnList = result.value.map(attribute => ({
              logicalName: attribute.LogicalName,
              displayName: attribute.DisplayName?.UserLocalizedLabel?.Label || attribute.LogicalName,
              attributeType: attribute.AttributeType,
              attributeTypeName: attribute.AttributeTypeName?.Value || "",
              isCustom: attribute.IsCustomAttribute,
              isManaged: attribute.IsManaged,
              requiredLevel: attribute.RequiredLevel?.Value || "None",
              isPrimaryId: attribute.IsPrimaryId,
              isPrimaryName: attribute.IsPrimaryName
            }));
    
            return {
              content: [
                {
                  type: "text",
                  text: `Found ${columnList.length} columns in table '${params.entityLogicalName}':\n\n${JSON.stringify(columnList, null, 2)}`
                }
              ]
            };
          } catch (error) {
            return {
              content: [
                {
                  type: "text",
                  text: `Error listing columns: ${error instanceof Error ? error.message : 'Unknown error'}`
                }
              ],
              isError: true
            };
          }
        }
      );
    }
  • src/index.ts:150-150 (registration)
    Invocation of listColumnsTool which triggers the registration of the 'list_dataverse_columns' tool on the MCP server.
    listColumnsTool(server, dataverseClient);
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It mentions 'filtering options' and 'supports filtering by custom/system columns and managed/unmanaged status,' which adds some behavioral context. However, it does not disclose critical details like whether this is a read-only operation, potential rate limits, authentication requirements, or the format of the returned list, leaving gaps for a tool with no annotation coverage.

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

Conciseness5/5

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

The description is front-loaded with the core purpose and efficiently uses three sentences to cover usage scenarios and filtering support. Every sentence adds value without redundancy, making it appropriately sized and well-structured.

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

Completeness3/5

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

Given no annotations and no output schema, the description provides adequate purpose and usage context but lacks details on behavioral traits (e.g., read-only nature, response format) and does not fully compensate for the missing structured data. It is complete enough for basic understanding but has clear gaps for a tool with 4 parameters and no output schema.

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%, so the schema already documents all parameters. The description adds minimal value by mentioning 'filtering options' and referencing 'custom/system columns and managed/unmanaged status,' which loosely maps to parameters like 'customOnly' and 'includeManaged,' but does not provide additional syntax or format details beyond what the schema provides. Baseline 3 is appropriate.

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

Purpose5/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 ('list of columns in a specific Dataverse table'), distinguishing it from siblings like 'get_dataverse_column' (singular) and 'list_dataverse_tables' (different resource). It specifies the purpose is to 'discover available fields, find custom columns, or get an overview of the table structure,' making it highly specific.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool ('to discover available fields, find custom columns, or get an overview of the table structure'), but does not explicitly mention when not to use it or name specific alternatives among the siblings (e.g., 'get_dataverse_column' for a single column). The guidance is helpful but lacks explicit exclusions.

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