remove_privilege_from_role
Remove specific permissions from a security role to restrict user access and maintain proper authorization controls in Microsoft Dataverse.
Instructions
Removes a specific privilege from a security role, revoking the associated permissions. Use this to restrict access by removing specific operation permissions from a role.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| privilegeId | Yes | ID of the privilege to remove | |
| roleId | Yes | ID of the role to remove privilege from |
Implementation Reference
- src/tools/role-tools.ts:377-403 (handler)The asynchronous handler function that implements the core logic of the tool by invoking the Dataverse 'RemovePrivilegeRole' action with the provided roleId and privilegeId, handling success and error responses.async (params) => { try { await client.callAction('RemovePrivilegeRole', { RoleId: params.roleId, PrivilegeId: params.privilegeId }); return { content: [ { type: "text", text: `Successfully removed privilege from role.` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error removing privilege from role: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } }
- src/tools/role-tools.ts:372-375 (schema)Zod-based input schema defining the required parameters: roleId (string) and privilegeId (string).inputSchema: { roleId: z.string().describe("ID of the role to remove privilege from"), privilegeId: z.string().describe("ID of the privilege to remove") }
- src/tools/role-tools.ts:367-404 (registration)Registers the 'remove_privilege_from_role' tool on the MCP server, including title, description, input schema, and handler.server.registerTool( "remove_privilege_from_role", { title: "Remove Privilege from Dataverse Role", description: "Removes a specific privilege from a security role, revoking the associated permissions. Use this to restrict access by removing specific operation permissions from a role.", inputSchema: { roleId: z.string().describe("ID of the role to remove privilege from"), privilegeId: z.string().describe("ID of the privilege to remove") } }, async (params) => { try { await client.callAction('RemovePrivilegeRole', { RoleId: params.roleId, PrivilegeId: params.privilegeId }); return { content: [ { type: "text", text: `Successfully removed privilege from role.` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error removing privilege from role: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } } );
- src/index.ts:188-188 (registration)Invokes the removePrivilegeFromRoleTool function to perform the actual tool registration on the main MCP server instance.removePrivilegeFromRoleTool(server, dataverseClient);