Skip to main content
Glama
hanweg

mcp-discord

by hanweg

add_role

Assign a specific Discord role to a user by specifying the server ID, user ID, and role ID. Simplifies role management within Discord servers for MCP clients.

Instructions

Add a role to a user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
role_idYesRole ID to add
server_idYesDiscord server ID
user_idYesUser to add role to

Implementation Reference

  • Handler function for the 'add_role' tool. Fetches the guild, member, and role using the provided IDs, then adds the role to the member with a reason.
    elif name == "add_role":
        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"]))
        
        await member.add_roles(role, reason="Role added via MCP")
        return [TextContent(
            type="text",
            text=f"Added role {role.name} to user {member.name}"
        )]
  • Registration of the 'add_role' tool via the list_tools() decorator. Defines the tool name, description, and input schema requiring server_id, user_id, and role_id.
    Tool(
        name="add_role",
        description="Add a role to a user",
        inputSchema={
            "type": "object",
            "properties": {
                "server_id": {
                    "type": "string",
                    "description": "Discord server ID"
                },
                "user_id": {
                    "type": "string",
                    "description": "User to add role to"
                },
                "role_id": {
                    "type": "string",
                    "description": "Role ID to add"
                }
            },
            "required": ["server_id", "user_id", "role_id"]
        }
    ),
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. 'Add a role to a user' implies a write/mutation operation but doesn't specify required permissions, whether this is reversible (though 'remove_role' sibling suggests it is), rate limits, or what happens on success/failure. For a Discord API mutation tool with zero annotation coverage, this leaves significant behavioral gaps.

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 maximally concise - a single clear sentence that states exactly what the tool does. There's zero wasted language, no unnecessary elaboration, and the core purpose is immediately apparent. This is an excellent example of efficient communication.

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 Discord role assignment tool with no annotations and no output schema, the description is insufficient. It doesn't cover important contextual elements like required permissions, error conditions, what the tool returns, or how this operation fits within Discord's role hierarchy. The agent would need to guess about many operational aspects.

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

Parameters3/5

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

Schema description coverage is 100%, with all three parameters clearly documented in the schema itself. The description adds no additional parameter context beyond what's already in the schema (role_id, server_id, user_id). This meets the baseline expectation when schema coverage is complete, but provides no extra semantic value.

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 ('Add') and target ('a role to a user'), making the purpose immediately understandable. It distinguishes from siblings like 'remove_role' by specifying the opposite operation, though it doesn't explicitly contrast with other user/role management tools. The description avoids tautology by not just restating the tool name.

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 (like needing admin permissions), when this operation is appropriate versus other role management approaches, or what happens if the role is already assigned. The agent must infer usage from 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

Related 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/hanweg/mcp-discord'

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