Skip to main content
Glama
idoyudha

mcp-keycloak

by idoyudha

remove_user_from_group

Remove a user from a group in Keycloak identity management by specifying user ID, group ID, and optional realm.

Instructions

Remove a user from a group.

Args:
    user_id: User ID
    group_id: Group ID
    realm: Target realm (uses default if not specified)

Returns:
    Status message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
user_idYes
group_idYes
realmNo

Implementation Reference

  • The handler function decorated with @mcp.tool(), which registers the tool and defines the input schema via type hints. It removes the user from the group by making a DELETE request to Keycloak API.
    @mcp.tool()
    async def remove_user_from_group(
        user_id: str, group_id: str, realm: Optional[str] = None
    ) -> Dict[str, str]:
        """
        Remove a user from a group.
    
        Args:
            user_id: User ID
            group_id: Group ID
            realm: Target realm (uses default if not specified)
    
        Returns:
            Status message
        """
        await client._make_request(
            "DELETE", f"/users/{user_id}/groups/{group_id}", realm=realm
        )
        return {
            "status": "removed",
            "message": f"User {user_id} removed from group {group_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