Remove Role from User
Removes a specific role from a user, given their user ID and the role slug, leaving any other roles they hold intact.
| Property | Value |
|---|---|
| Ability slug | mosmcp/remove-role-from-user |
| Wire tool name | mosmcp__remove-role-from-user |
| Category | Users & Roles (mosmcp-users) |
| Plan | Free |
Required access
| Requirement | Value |
|---|---|
| Capability | promote_users |
| Minimum default role | Administrator |
| Annotations | readOnly: false · destructive: true · idempotent: true · openWorld: false |
Input schema
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| id | integer (min 1) | Yes | — | The user ID to change (required). |
| role | string | Yes | — | The role slug (required). See mosmcp/list-roles for valid slugs. You may only grant a role whose capabilities you already hold. |
Output schema
| Field | Type | Required |
|---|---|---|
| id | integer | Yes |
| roles | string[] | Yes |
Example
Sample prompt
Take the Shop Manager role away from user #42 but keep their other roles.
Example request (json)
{
"jsonrpc": "2.0",
"id": 193,
"method": "tools/call",
"params": {
"name": "mosmcp__remove-role-from-user",
"arguments": {
"input": {
"id": 42,
"role": "shop_manager"
}
}
}
}Example response (json)
{
"jsonrpc": "2.0",
"id": 193,
"result": {
"isError": false,
"structuredContent": {
"id": 42,
"roles": [
"editor"
]
}
}
}
Edge cases / errors
- Removing a role the user doesn't have → no change; the current roles are returned.
- Removing the user's only role leaves them with no role on the site (empty roles).
- The same grant check applies to removal: a role with any capability the caller doesn't hold → mosmcp_cannot_grant_role; unknown role → mosmcp_invalid_role.
- No user with that id → mosmcp_user_not_found; no right to change this user's role → mosmcp_cannot_promote.
| << Previous | Next >> |
|---|---|
| List Users | Reset User's Password |
For more information about the Secure MCP Server for WordPress plugin, explore the following resources:
Product Overview | Pricing | Try for Free | Documentation
If you have any questions regarding plugin configuration, pricing plans or licensing, please contact us or mail us at aisupport@xecurify.com.