Skip to main content
Glama
wowjinxy
by wowjinxy

remove_role

Remove a Discord role from a user by specifying user ID and role ID. This tool manages server permissions and member access within Discord communities.

Instructions

Remove a role from a Discord user.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
user_idYes
role_idYes
server_idNo
reasonNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function that implements the core logic for the 'remove_role' tool. It fetches the guild, member, and role using the provided IDs, checks if the role exists, removes the role from the member, and returns a confirmation message.
    @staticmethod
    async def handle_remove_role(discord_client, arguments: Dict[str, Any]) -> List[TextContent]:
        """Remove a role from a user"""
        guild = await discord_client.fetch_guild(int(arguments["server_id"]))
        member = await guild.fetch_member(int(arguments["user_id"]))
        role = guild.get_role(int(arguments["role_id"]))
        
        if not role:
            return [TextContent(type="text", text="Role not found")]
        
        await member.remove_roles(role, reason="Role removed via MCP")
        
        return [TextContent(
            type="text",
            text=f"Removed role '{role.name}' from {member.display_name} in {guild.name}"
        )]
  • Registers the 'remove_role' tool with the MCP server in the list_tools() function. Includes the tool name, description, and input schema defining required parameters: server_id, user_id, role_id.
    Tool(
        name="remove_role",
        description="Remove a role from a user",
        inputSchema={
            "type": "object",
            "properties": {
                "server_id": {
                    "type": "string",
                    "description": "Discord server ID"
                },
                "user_id": {
                    "type": "string",
                    "description": "User to remove role from"
                },
                "role_id": {
                    "type": "string",
                    "description": "Role ID to remove"
                }
            },
            "required": ["server_id", "user_id", "role_id"]
        }
    ),
  • In the call_tool handler, 'remove_role' is included in core_tool_names list, which routes the tool call to CoreToolHandlers.handle_remove_role for execution.
    core_tool_names = [
        "get_server_info", "list_servers", "get_channels", "list_members",
        "get_user_info", "send_message", "read_messages", "add_reaction",
        "add_multiple_reactions", "remove_reaction", "moderate_message",
        "create_text_channel", "delete_channel", "add_role", "remove_role"
    ]
    
    if name in core_tool_names:
        handler_method = f"handle_{name}"
        if hasattr(CoreToolHandlers, handler_method):
            return await getattr(CoreToolHandlers, handler_method)(discord_client, arguments)
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure but offers minimal information. It states the action is a removal but doesn't describe what happens after removal (e.g., whether it's reversible, if audit logs are created, or if it requires specific bot permissions). For a mutation tool with security implications, this lack of context is a significant gap.

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 a single, direct sentence with zero wasted words. It's front-loaded with the core action and resource, making it immediately scannable. Every word earns its place by conveying essential purpose without redundancy.

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

Completeness2/5

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

For a mutation tool with 4 parameters, 0% schema coverage, no annotations, and security implications, the description is inadequate. It lacks behavioral context, parameter explanations, usage guidance, and doesn't leverage the output schema to clarify results. While concise, it fails to provide the completeness needed for safe and effective tool invocation.

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

Parameters2/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 but adds no parameter information. It doesn't explain what 'user_id', 'role_id', 'server_id', or 'reason' represent, their formats, or how they interact. The agent must rely solely on schema titles, which are minimal (e.g., 'User Id' without context).

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') and target ('a role from a Discord user'), making the purpose immediately understandable. It distinguishes from obvious siblings like 'add_role' and 'delete_role' by specifying removal from a user rather than deletion of the role itself. However, it doesn't explicitly differentiate from all potential alternatives like 'edit_role' for permission changes.

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., needing appropriate permissions), when not to use it, or how it differs from related tools like 'kick_member' or 'timeout_member' for user management. The agent must infer usage from the name and context 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/wowjinxy/mcp-discord'

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