Skip to main content
Glama
mwhesse

Dataverse MCP Server

by mwhesse

Get Dataverse Role Privileges

get_role_privileges

Retrieve all privileges assigned to a security role to audit permissions and understand what access the role provides to users and teams in Microsoft Dataverse.

Instructions

Retrieves all privileges currently assigned to a security role, showing what permissions the role grants. Use this to audit role permissions and understand what access a role provides to users and teams.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
roleIdYesID of the role to retrieve privileges for

Implementation Reference

  • The core handler function that executes the tool logic: fetches privileges for a given role ID using Dataverse Web API $expand on roleprivileges_association, maps to privilegeId and name, and returns formatted response.
    async (params) => {
      try {
        // Get role privileges using the correct Web API approach from Microsoft documentation
        // Using $expand to get the roleprivileges_association collection
        const response = await client.get(`roles(${params.roleId})?$select=roleid&$expand=roleprivileges_association($select=name,privilegeid)&$orderby=name`);
    
        const rolePrivileges = response.roleprivileges_association || [];
        const privileges = rolePrivileges.map((privilege: any) => ({
          privilegeId: privilege.privilegeid,
          privilegeName: privilege.name
        }));
    
        return {
          content: [
            {
              type: "text",
              text: `Role privileges (${privileges.length} found):\n\n${JSON.stringify(privileges, null, 2)}`
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error retrieving role privileges: ${error instanceof Error ? error.message : 'Unknown error'}`
            }
          ],
          isError: true
        };
      }
    }
  • Zod input schema validating the required 'roleId' parameter as a string.
    inputSchema: {
      roleId: z.string().describe("ID of the role to retrieve privileges for")
    }
  • MCP server tool registration call within getRolePrivilegesTool export function, specifying name, metadata, schema, and handler.
    server.registerTool(
      "get_role_privileges",
      {
        title: "Get Dataverse Role Privileges",
        description: "Retrieves all privileges currently assigned to a security role, showing what permissions the role grants. Use this to audit role permissions and understand what access a role provides to users and teams.",
        inputSchema: {
          roleId: z.string().describe("ID of the role to retrieve privileges for")
        }
      },
      async (params) => {
        try {
          // Get role privileges using the correct Web API approach from Microsoft documentation
          // Using $expand to get the roleprivileges_association collection
          const response = await client.get(`roles(${params.roleId})?$select=roleid&$expand=roleprivileges_association($select=name,privilegeid)&$orderby=name`);
    
          const rolePrivileges = response.roleprivileges_association || [];
          const privileges = rolePrivileges.map((privilege: any) => ({
            privilegeId: privilege.privilegeid,
            privilegeName: privilege.name
          }));
    
          return {
            content: [
              {
                type: "text",
                text: `Role privileges (${privileges.length} found):\n\n${JSON.stringify(privileges, null, 2)}`
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error retrieving role privileges: ${error instanceof Error ? error.message : 'Unknown error'}`
              }
            ],
            isError: true
          };
        }
      }
    );
  • src/index.ts:190-190 (registration)
    Invocation in main index file that calls getRolePrivilegesTool to register the tool with the MCP server instance and Dataverse client.
    getRolePrivilegesTool(server, dataverseClient);
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It correctly implies a read-only operation ('retrieves', 'shows'), but doesn't address critical behavioral aspects like authentication requirements, rate limits, error conditions, pagination, or response format. The description provides basic intent but lacks operational transparency.

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 core functionality, the second provides usage context. Every word serves a purpose with zero redundancy, and key information is front-loaded. It's appropriately sized for a single-parameter read tool.

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 tool with no annotations and no output schema, the description is insufficiently complete. While it states the purpose clearly, it doesn't describe the return format (what privileges look like), error handling, or operational constraints. Given the complexity of security/privilege data and absence of structured output documentation, more behavioral context is needed.

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 roleId parameter clearly documented. The description doesn't add any parameter-specific information beyond what the schema already provides (e.g., format examples, validation rules, or relationship to other tools). This meets the baseline expectation when schema coverage is complete.

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', 'shows') and resource ('privileges assigned to a security role'). It distinguishes this as a read operation focused on privileges rather than role metadata, but doesn't explicitly differentiate from potential sibling tools like 'get_dataverse_role' which might retrieve role properties rather than privileges.

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 provides implied usage context ('audit role permissions', 'understand what access a role provides'), suggesting this is for permission analysis rather than role management. However, it doesn't explicitly state when to use this versus alternatives like 'get_dataverse_role' or 'list_dataverse_roles', nor does it mention prerequisites or exclusions.

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