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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

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}",
        }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states the action is a removal but doesn't disclose behavioral traits: whether this requires admin permissions, if it's reversible, what happens if the user isn't in the group, rate limits, or side effects. The description adds minimal value beyond the obvious 'remove' action, leaving critical behavioral context unspecified.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is perfectly front-loaded with the core purpose in the first sentence, followed by structured Args and Returns sections. Every sentence earns its place: the purpose statement is essential, and the parameter/return explanations are necessary given the lack of schema descriptions. Zero waste or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (a mutation with no annotations) and schema richness (0% coverage but with output schema), the description is minimally adequate. It covers parameters well and notes a return type, but lacks behavioral context for a destructive operation. The output schema existence means return values don't need explanation, but other gaps (permissions, reversibility) remain. This meets baseline for a mutation tool with output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It adds meaningful semantics for all three parameters: 'user_id' and 'group_id' are clearly explained, and 'realm' gets context about default behavior. This goes beyond the schema's bare titles, though it doesn't specify format (e.g., UUIDs) or constraints. With 0% coverage, this is strong compensation but not exhaustive.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Remove a user from a group') with specific verb and resource. It distinguishes itself from siblings like 'add_user_to_group' and 'delete_user' by focusing on group membership removal rather than addition or user deletion. However, it doesn't explicitly differentiate from 'remove_realm_role_from_user' which is a similar removal operation but for roles rather than groups.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., user must exist in the group), when not to use it (e.g., vs deleting the user entirely), or compare with sibling tools like 'remove_realm_role_from_user' or 'delete_user'. The agent must infer usage from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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