Delete Dataverse Security Role
delete_dataverse_roleRemove security roles from Microsoft Dataverse to maintain clean access control. This permanent deletion requires verifying the role is not currently assigned to users or teams.
Instructions
Permanently deletes a security role from Dataverse. WARNING: This action cannot be undone and will fail if the role is assigned to any users or teams. Ensure the role is not in use before deletion.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| roleId | Yes | ID of the role to delete |
Implementation Reference
- src/tools/role-tools.ts:209-233 (handler)The core handler function that executes the tool by deleting the Dataverse security role with the given roleId using the DataverseClient.
async (params) => { try { await client.delete(`roles(${params.roleId})`); return { content: [ { type: "text", text: `Successfully deleted security role.` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error deleting security role: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } } ); - src/tools/role-tools.ts:202-208 (schema)The input schema and metadata for the tool, defining the required 'roleId' parameter of type string.
{ title: "Delete Dataverse Security Role", description: "Permanently deletes a security role from Dataverse. WARNING: This action cannot be undone and will fail if the role is assigned to any users or teams. Ensure the role is not in use before deletion.", inputSchema: { roleId: z.string().describe("ID of the role to delete") } }, - src/tools/role-tools.ts:200-234 (registration)The server.registerTool call within deleteRoleTool function that registers the tool with name 'delete_dataverse_role'.
server.registerTool( "delete_dataverse_role", { title: "Delete Dataverse Security Role", description: "Permanently deletes a security role from Dataverse. WARNING: This action cannot be undone and will fail if the role is assigned to any users or teams. Ensure the role is not in use before deletion.", inputSchema: { roleId: z.string().describe("ID of the role to delete") } }, async (params) => { try { await client.delete(`roles(${params.roleId})`); return { content: [ { type: "text", text: `Successfully deleted security role.` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error deleting security role: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } } ); } - src/index.ts:183-183 (registration)The invocation of deleteRoleTool which triggers the tool registration on the MCP server.
deleteRoleTool(server, dataverseClient);