Skip to main content
Glama
mwhesse

Dataverse MCP Server

by mwhesse

Get Business Unit Hierarchy

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

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions retrieval and shows relationships, but fails to disclose critical traits like whether this is a read-only operation, potential permissions needed, rate limits, or what the output format looks like (e.g., tree structure, JSON). This leaves significant gaps for an AI agent to understand the tool's behavior.

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 appropriately sized and front-loaded, with two sentences that efficiently convey the tool's purpose and usage without waste. Every sentence adds value, making it easy to parse and understand quickly.

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?

Given the complexity of retrieving hierarchical data and the lack of annotations and output schema, the description is incomplete. It doesn't explain the return structure (e.g., nested objects, depth), potential limitations, or error handling, which are crucial for an AI agent to use this tool effectively in context.

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?

The input schema has 100% description coverage, with the parameter 'businessUnitId' clearly documented as a unique identifier. The description adds no additional parameter semantics beyond what the schema provides, such as format examples or constraints. Baseline 3 is appropriate when 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 tool's purpose with specific verbs ('retrieves', 'showing') and resources ('organizational hierarchy', 'business unit relationships'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'get_businessunit_teams' or 'get_businessunit_users', which prevents a perfect score.

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

Usage Guidelines3/5

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

The description implies usage context by stating 'Use this to understand business unit relationships and organizational structure,' which suggests when to use it. However, it lacks explicit guidance on when not to use it or alternatives among sibling tools, such as distinguishing from 'list_dataverse_businessunits' or 'get_dataverse_businessunit'.

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