Skip to main content
Glama
mwhesse

Dataverse MCP Server

by mwhesse

Assign Role to Team

assign_role_to_team

Assign security roles to teams to provide consistent access permissions for groups of users working on similar tasks in Microsoft Dataverse.

Instructions

Assigns a security role to a team, granting all team members the permissions defined in that role. Use this to provide consistent access levels to groups of users working together on similar tasks.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
roleIdYesID of the role to assign
teamIdYesID of the team to assign the role to

Implementation Reference

  • The exported assignRoleToTeamTool function defines and registers the MCP tool 'assign_role_to_team' with Zod input schema and async handler that performs the role assignment via Dataverse Web API.
    export function assignRoleToTeamTool(server: McpServer, client: DataverseClient) {
      server.registerTool(
        "assign_role_to_team",
        {
          title: "Assign Role to Team",
          description: "Assigns a security role to a team, granting all team members the permissions defined in that role. Use this to provide consistent access levels to groups of users working together on similar tasks.",
          inputSchema: {
            roleId: z.string().describe("ID of the role to assign"),
            teamId: z.string().describe("ID of the team to assign the role to")
          }
        },
        async (params) => {
          try {
            await client.post(`teams(${params.teamId})/teamroles_association/$ref`, {
              "@odata.id": `${client['config'].dataverseUrl}/api/data/v9.2/roles(${params.roleId})`
            });
    
            return {
              content: [
                {
                  type: "text",
                  text: `Successfully assigned role to team.`
                }
              ]
            };
          } catch (error) {
            return {
              content: [
                {
                  type: "text",
                  text: `Error assigning role to team: ${error instanceof Error ? error.message : 'Unknown error'}`
                }
              ],
              isError: true
            };
          }
        }
      );
    }
  • src/index.ts:195-195 (registration)
    Invocation of assignRoleToTeamTool to register the tool on the main MCP server instance.
    assignRoleToTeamTool(server, dataverseClient);
  • Tool metadata including title, description, and Zod input schema for validation.
    {
      title: "Assign Role to Team",
      description: "Assigns a security role to a team, granting all team members the permissions defined in that role. Use this to provide consistent access levels to groups of users working together on similar tasks.",
      inputSchema: {
        roleId: z.string().describe("ID of the role to assign"),
        teamId: z.string().describe("ID of the team to assign the role to")
      }
    },
  • The core handler logic that posts to the Dataverse Web API endpoint to associate the role with the team.
      async (params) => {
        try {
          await client.post(`teams(${params.teamId})/teamroles_association/$ref`, {
            "@odata.id": `${client['config'].dataverseUrl}/api/data/v9.2/roles(${params.roleId})`
          });
    
          return {
            content: [
              {
                type: "text",
                text: `Successfully assigned role to team.`
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error assigning role to team: ${error instanceof Error ? error.message : 'Unknown error'}`
              }
            ],
            isError: true
          };
        }
      }
    );
Behavior2/5

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

With no annotations provided, the description carries full burden but provides minimal behavioral information. It mentions the effect ('granting all team members the permissions') but doesn't disclose important traits like whether this is a write operation, what permissions are required, whether it's idempotent, or what happens on failure. For a security role assignment tool with zero annotation coverage, this is inadequate.

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 efficiently structured in two sentences: the first states the action and effect, the second provides usage context. Every sentence earns its place with no wasted words, and the most important information is front-loaded.

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?

For a security/permissions mutation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what the tool returns, error conditions, side effects, or security implications. The description should provide more complete context given the tool's complexity and lack of structured metadata.

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 both parameters completely. The description doesn't add any parameter-specific information beyond what's in the schema (roleId and teamId). This meets the baseline expectation when schema coverage is high.

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 specific action ('Assigns a security role to a team') and the outcome ('granting all team members the permissions defined in that role'). It distinguishes from sibling tools like 'assign_role_to_user' by specifying it applies to teams rather than individual users.

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 provide consistent access levels to groups of users working together on similar tasks'), which helps differentiate it from user-level assignment. However, it doesn't explicitly mention when NOT to use it or name specific alternatives like 'assign_role_to_user'.

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