Skip to main content
Glama
mwhesse

Dataverse MCP Server

by mwhesse

get_businessunit_hierarchy

Retrieve the complete organizational hierarchy for a business unit to understand parent-child relationships and organizational structure within Dataverse.

Instructions

Retrieves the complete organizational hierarchy for a specific business unit, showing parent-child relationships and the full organizational structure. Use this to understand business unit relationships and organizational structure.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
businessUnitIdYesUnique identifier of the business unit to get hierarchy for

Implementation Reference

  • The handler function that implements the core logic of the 'get_businessunit_hierarchy' tool by calling the Dataverse bound function 'RetrieveBusinessHierarchyBusinessUnit' to fetch the complete organizational hierarchy.
    async (params: any) => { try { // Use the RetrieveBusinessHierarchyBusinessUnit bound function const response = await client.get(`businessunits(${params.businessUnitId})/Microsoft.Dynamics.CRM.RetrieveBusinessHierarchyBusinessUnit()`); return { content: [ { type: "text", text: `Business unit hierarchy:\n\n${JSON.stringify(response, null, 2)}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error retrieving business unit hierarchy: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } }
  • The input schema defining the required 'businessUnitId' parameter for the tool.
    inputSchema: { businessUnitId: z.string().describe("Unique identifier of the business unit to get hierarchy for") }
  • The exported factory function that registers the 'get_businessunit_hierarchy' tool, including schema and handler.
    export function getBusinessUnitHierarchyTool(server: McpServer, client: DataverseClient) { server.registerTool( "get_businessunit_hierarchy", { title: "Get Business Unit Hierarchy", description: "Retrieves the complete organizational hierarchy for a specific business unit, showing parent-child relationships and the full organizational structure. Use this to understand business unit relationships and organizational structure.", inputSchema: { businessUnitId: z.string().describe("Unique identifier of the business unit to get hierarchy for") } }, async (params: any) => { try { // Use the RetrieveBusinessHierarchyBusinessUnit bound function const response = await client.get(`businessunits(${params.businessUnitId})/Microsoft.Dynamics.CRM.RetrieveBusinessHierarchyBusinessUnit()`); return { content: [ { type: "text", text: `Business unit hierarchy:\n\n${JSON.stringify(response, null, 2)}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error retrieving business unit hierarchy: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } } ); }
  • src/index.ts:219-219 (registration)
    Invocation of the registration factory function in the main server setup.
    getBusinessUnitHierarchyTool(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