reset_user_password
Reset a user's password in Keycloak identity management, optionally setting it as temporary to require change on next login.
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 |
|---|---|---|---|
| user_id | Yes | ||
| password | Yes | ||
| temporary | No | ||
| realm | No |
Implementation Reference
- src/tools/user_tools.py:190-211 (handler)The primary handler for the 'reset_user_password' tool. It is decorated with @mcp.tool() which also serves as its registration. The function resets the user's password by making a PUT request to the Keycloak API endpoint /users/{user_id}/reset-password.@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}"}