reset_user_password
Reset a user's password in the mcp-keycloak server using the user ID and new password. Optionally set the password as temporary, requiring the user to change it on next login. Specify the target realm if needed.
Instructions
Reset a user's password.
Args:
user_id: The user's ID
password: New password
temporary: Whether the password is temporary (user must change on next login)
realm: Target realm (uses default if not specified)
Returns:
Status message
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| password | Yes | ||
| realm | No | ||
| temporary | No | ||
| user_id | Yes |
Implementation Reference
- src/tools/user_tools.py:190-211 (handler)The main handler function for the 'reset_user_password' tool, decorated with @mcp.tool() for registration. It resets the user's password via Keycloak API.@mcp.tool() async def reset_user_password( user_id: str, password: str, temporary: bool = True, realm: Optional[str] = None ) -> Dict[str, str]: """ Reset a user's password. Args: user_id: The user's ID password: New password temporary: Whether the password is temporary (user must change on next login) realm: Target realm (uses default if not specified) Returns: Status message """ credential_data = {"type": "password", "value": password, "temporary": temporary} await client._make_request( "PUT", f"/users/{user_id}/reset-password", data=credential_data, realm=realm ) return {"status": "success", "message": f"Password reset for user {user_id}"}