assign-role-to-user
Assign a specified role to a user in Keycloak. Provide realm, user ID, and role name; optionally include client ID to assign a client role.
Instructions
Assign a realm role, or a client role when clientId is given, to a user
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"realm": "<realm>",
"userId": "<userId>",
"roleName": "<roleName>"
},
"name": "assign-role-to-user"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| realm | Yes | Realm name | |
| userId | Yes | User ID | |
| clientId | No | Client ID to resolve roleName as a client role. Omit for a realm role | |
| roleName | Yes | Role name |