Skip to main content
Glama
mwhesse

Dataverse MCP Server

by mwhesse

assign_role_to_user

Assign security roles to users to grant appropriate access permissions for their job functions and responsibilities in Microsoft Dataverse.

Instructions

Assigns a security role to a specific user, granting them all the permissions defined in that role. Use this to provide users with the appropriate access levels for their job functions and responsibilities.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
roleIdYesID of the role to assign
userIdYesID of the user to assign the role to

Implementation Reference

  • The async handler function that performs the core logic: posts to Dataverse API to associate a role with a user and returns success or error response.
    async (params) => { try { await client.post(`systemusers(${params.userId})/systemuserroles_association/$ref`, { "@odata.id": `${client['config'].dataverseUrl}/api/data/v9.2/roles(${params.roleId})` }); return { content: [ { type: "text", text: `Successfully assigned role to user.` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error assigning role to user: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } }
  • Zod-based input schema defining required parameters: roleId and userId.
    inputSchema: { roleId: z.string().describe("ID of the role to assign"), userId: z.string().describe("ID of the user to assign the role to") }
  • The server.registerTool call that registers the tool with name, metadata, schema, and handler function.
    server.registerTool( "assign_role_to_user", { title: "Assign Role to User", description: "Assigns a security role to a specific user, granting them all the permissions defined in that role. Use this to provide users with the appropriate access levels for their job functions and responsibilities.", inputSchema: { roleId: z.string().describe("ID of the role to assign"), userId: z.string().describe("ID of the user to assign the role to") } }, async (params) => { try { await client.post(`systemusers(${params.userId})/systemuserroles_association/$ref`, { "@odata.id": `${client['config'].dataverseUrl}/api/data/v9.2/roles(${params.roleId})` }); return { content: [ { type: "text", text: `Successfully assigned role to user.` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error assigning role to user: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } } );
  • src/index.ts:193-193 (registration)
    Invocation of the registration function in the main server setup.
    assignRoleToUserTool(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