Skip to main content
Glama
mwhesse

Dataverse MCP Server

by mwhesse

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);

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