edit_role
Modify Discord role settings like name, color, permissions, and visibility to customize server member access and organization.
Instructions
Update the configuration of an existing role.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"role_id": "<role_id>"
},
"name": "edit_role"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| role_id | Yes | ||
| server_id | No | ||
| name | No | ||
| color | No | ||
| colour | No | ||
| hoist | No | ||
| mentionable | No | ||
| permissions | No | ||
| permissions_value | No | ||
| position | No | ||
| unicode_emoji | No | ||
| reason | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- The core handler function that implements the edit_role tool. It fetches the guild and role, collects changes to name, color, permissions, hoist, mentionable, position, and reason, then edits the role and returns a summary of changes.
async def handle_edit_role(discord_client, arguments: Dict[str, Any]) -> List[TextContent]: """Edit an existing role""" guild = await discord_client.fetch_guild(int(arguments["server_id"])) role = guild.get_role(int(arguments["role_id"])) if not role: return [TextContent(type="text", text="Role not found")] edit_kwargs = {} changes_made = [] if "name" in arguments: edit_kwargs["name"] = arguments["name"] changes_made.append(f"Name: {arguments['name']}") if "color" in arguments: edit_kwargs["color"] = hex_to_color(arguments["color"]) changes_made.append(f"Color: {arguments['color']}") if "permissions" in arguments: edit_kwargs["permissions"] = parse_permissions(arguments["permissions"]) changes_made.append("Permissions updated") if "hoist" in arguments: edit_kwargs["hoist"] = arguments["hoist"] changes_made.append(f"Hoisted: {arguments['hoist']}") if "mentionable" in arguments: edit_kwargs["mentionable"] = arguments["mentionable"] changes_made.append(f"Mentionable: {arguments['mentionable']}") if "position" in arguments: edit_kwargs["position"] = arguments["position"] changes_made.append(f"Position: {arguments['position']}") edit_kwargs["reason"] = arguments.get("reason", "Role updated via MCP") if edit_kwargs: await role.edit(**edit_kwargs) return [TextContent( type="text", text=f"Updated role '{role.name}':\n• " + "\n• ".join(changes_made) )] - The input schema defining parameters for the edit_role tool, including required server_id and role_id, and optional properties for editing.
Tool( name="edit_role", description="Edit an existing role's properties and permissions", inputSchema={ "type": "object", "properties": { "server_id": {"type": "string", "description": "Server ID"}, "role_id": {"type": "string", "description": "Role ID"}, "name": {"type": "string", "description": "New role name"}, "color": {"type": "string", "description": "New role color (hex)"}, "permissions": {"type": "array", "items": {"type": "string"}, "description": "New permissions"}, "hoist": {"type": "boolean", "description": "Whether role is displayed separately"}, "mentionable": {"type": "boolean", "description": "Whether role is mentionable"}, "position": {"type": "number", "description": "New role position"}, "reason": {"type": "string", "description": "Reason for edit"} }, "required": ["server_id", "role_id"] } ), - src/discord_mcp/integrated_server.py:1014-1019 (registration)The dynamic dispatch/registration code in call_tool that routes 'edit_role' calls (as part of advanced_tool_names) to AdvancedToolHandlers.handle_edit_role.
if name in advanced_tool_names: handler_method = f"handle_{name}" if hasattr(AdvancedToolHandlers, handler_method): return await getattr(AdvancedToolHandlers, handler_method)(discord_client, arguments)