Skip to main content
Glama
idoyudha

mcp-keycloak

by idoyudha

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
NameRequiredDescriptionDefault
user_idYes
passwordYes
temporaryNo
realmNo

Implementation Reference

  • 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}"}

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/idoyudha/mcp-keycloak'

If you have feedback or need assistance with the MCP directory API, please join our Discord server