Skip to main content
Glama
mwhesse

Dataverse MCP Server

by mwhesse

Get Business Unit Teams

get_businessunit_teams

Retrieve all teams associated with a specific business unit, with option to include teams from subsidiary units. Use this to understand team organization and business unit relationships.

Instructions

Retrieves all teams associated with a specific business unit, with option to include teams from subsidiary business units. Use this to understand team organization and business unit relationships.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
businessUnitIdYesUnique identifier of the business unit
includeSubsidiaryTeamsNoWhether to include teams from subsidiary business units

Implementation Reference

  • The core handler function that executes the tool logic. It constructs the appropriate Dataverse API endpoint based on whether subsidiary teams are included, fetches the data, formats it with team type labels, and returns a formatted text response or error.
    async (params: any) => {
      try {
        let endpoint: string;
        
        if (params.includeSubsidiaryTeams) {
          // Use the RetrieveSubsidiaryTeamsBusinessUnit function
          endpoint = `RetrieveSubsidiaryTeamsBusinessUnit(BusinessUnitId=${params.businessUnitId})`;
        } else {
          // Get teams directly associated with the business unit
          endpoint = `teams?$filter=businessunitid/businessunitid eq ${params.businessUnitId}&$select=teamid,name,teamtype,businessunitid&$expand=businessunitid($select=name)`;
        }
    
        const result = await client.get(endpoint);
        const teams = params.includeSubsidiaryTeams ? result : result.value;
    
        const formattedTeams = (Array.isArray(teams) ? teams : teams?.value || []).map((team: any) => ({
          teamId: team.teamid,
          name: team.name,
          teamType: team.teamtype,
          teamTypeLabel: getTeamTypeLabel(team.teamtype),
          businessUnitId: team.businessunitid,
          businessUnitName: team.businessunitid?.name
        }));
    
        return {
          content: [
            {
              type: "text",
              text: `Found ${formattedTeams.length} ${params.includeSubsidiaryTeams ? 'subsidiary ' : ''}teams for business unit:\n\n${JSON.stringify(formattedTeams, null, 2)}`
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error retrieving business unit teams: ${error instanceof Error ? error.message : 'Unknown error'}`
            }
          ],
          isError: true
        };
      }
    }
  • The tool schema defining title, description, and input validation using Zod for businessUnitId (required string) and includeSubsidiaryTeams (optional boolean, default false).
    {
      title: "Get Business Unit Teams",
      description: "Retrieves all teams associated with a specific business unit, with option to include teams from subsidiary business units. Use this to understand team organization and business unit relationships.",
      inputSchema: {
        businessUnitId: z.string().describe("Unique identifier of the business unit"),
        includeSubsidiaryTeams: z.boolean().optional().default(false).describe("Whether to include teams from subsidiary business units")
      }
    },
  • The server.registerTool call that registers the tool with its name, schema, and handler function within the getBusinessUnitTeamsTool setup function.
    server.registerTool(
      "get_businessunit_teams",
      {
        title: "Get Business Unit Teams",
        description: "Retrieves all teams associated with a specific business unit, with option to include teams from subsidiary business units. Use this to understand team organization and business unit relationships.",
        inputSchema: {
          businessUnitId: z.string().describe("Unique identifier of the business unit"),
          includeSubsidiaryTeams: z.boolean().optional().default(false).describe("Whether to include teams from subsidiary business units")
        }
      },
      async (params: any) => {
        try {
          let endpoint: string;
          
          if (params.includeSubsidiaryTeams) {
            // Use the RetrieveSubsidiaryTeamsBusinessUnit function
            endpoint = `RetrieveSubsidiaryTeamsBusinessUnit(BusinessUnitId=${params.businessUnitId})`;
          } else {
            // Get teams directly associated with the business unit
            endpoint = `teams?$filter=businessunitid/businessunitid eq ${params.businessUnitId}&$select=teamid,name,teamtype,businessunitid&$expand=businessunitid($select=name)`;
          }
    
          const result = await client.get(endpoint);
          const teams = params.includeSubsidiaryTeams ? result : result.value;
    
          const formattedTeams = (Array.isArray(teams) ? teams : teams?.value || []).map((team: any) => ({
            teamId: team.teamid,
            name: team.name,
            teamType: team.teamtype,
            teamTypeLabel: getTeamTypeLabel(team.teamtype),
            businessUnitId: team.businessunitid,
            businessUnitName: team.businessunitid?.name
          }));
    
          return {
            content: [
              {
                type: "text",
                text: `Found ${formattedTeams.length} ${params.includeSubsidiaryTeams ? 'subsidiary ' : ''}teams for business unit:\n\n${JSON.stringify(formattedTeams, null, 2)}`
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error retrieving business unit teams: ${error instanceof Error ? error.message : 'Unknown error'}`
              }
            ],
            isError: true
          };
        }
      }
    );
  • src/index.ts:222-222 (registration)
    Invocation of the getBusinessUnitTeamsTool function during server initialization, which triggers the actual tool registration.
    getBusinessUnitTeamsTool(server, dataverseClient);
  • Helper utility function that converts numerical team type values to human-readable labels, used in the handler to enrich team data.
    function getTeamTypeLabel(teamType: number): string {
      switch (teamType) {
        case 0: return 'Owner';
        case 1: return 'Access';
        case 2: return 'Security Group';
        case 3: return 'Office Group';
        default: return 'Unknown';
      }
    }
Behavior2/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 of behavioral disclosure. It states the tool retrieves data, implying a read-only operation, but does not address potential behavioral traits like error handling, rate limits, authentication requirements, or what happens if the business unit ID is invalid. For a tool with zero annotation coverage, this leaves significant gaps in understanding its operational 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 concise sentences: the first states the core functionality, and the second provides usage context. Every sentence earns its place without redundancy or unnecessary detail, making it efficient and easy to parse.

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 the tool's moderate complexity (2 parameters, no output schema, no annotations), the description is adequate but incomplete. It covers the purpose and basic usage but lacks details on behavioral aspects like error conditions or return format, which are important for a retrieval tool. Without annotations or output schema, more context on what the tool returns would enhance completeness.

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 fully documents both parameters (businessUnitId and includeSubsidiaryTeams). The description adds minimal value beyond the schema by mentioning the option to include subsidiary teams, but does not provide additional semantic context, such as how subsidiary relationships are defined or the impact on performance. 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.

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 ('all teams associated with a specific business unit'), making the purpose specific and actionable. It distinguishes this tool from sibling tools like 'get_businessunit_users' or 'get_dataverse_team' by focusing on business unit-team relationships, not users or general team details.

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 understand team organization and business unit relationships'), which helps guide usage. However, it does not explicitly mention when not to use it or name specific alternatives among the many sibling tools, such as 'get_dataverse_team' for individual team details or 'get_businessunit_hierarchy' for broader unit structures.

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