delete_role
Remove a role from a Discord server to manage permissions and organize members. Specify role ID and optional server ID with reason for deletion.
Instructions
Delete a role from the server.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| role_id | Yes | ||
| server_id | No | ||
| reason | No |
Implementation Reference
- The handler function that executes the delete_role tool by fetching the guild and role, checking if role exists, deleting it, and returning confirmation.async def handle_delete_role(discord_client, arguments: Dict[str, Any]) -> List[TextContent]: """Delete a 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")] role_name = role.name await role.delete(reason=arguments.get("reason", "Role deleted via MCP")) return [TextContent( type="text", text=f"Deleted role '{role_name}' from {guild.name}" )]
- src/discord_mcp/integrated_server.py:315-327 (registration)Registers the delete_role tool in the MCP server's list_tools() with its name, description, and input schema.Tool( name="delete_role", description="Delete a role from the server", inputSchema={ "type": "object", "properties": { "server_id": {"type": "string", "description": "Server ID"}, "role_id": {"type": "string", "description": "Role ID to delete"}, "reason": {"type": "string", "description": "Reason for deletion"} }, "required": ["server_id", "role_id"] } ),
- Defines the input schema for the delete_role tool, specifying required server_id and role_id parameters.inputSchema={ "type": "object", "properties": { "server_id": {"type": "string", "description": "Server ID"}, "role_id": {"type": "string", "description": "Role ID to delete"}, "reason": {"type": "string", "description": "Reason for deletion"} }, "required": ["server_id", "role_id"] }
- src/discord_mcp/integrated_server.py:1005-1013 (registration)Includes 'delete_role' in the list of advanced tools routed to AdvancedToolHandlers.handle_* methods.advanced_tool_names = [ "edit_server_settings", "create_server_template", "create_channel_category", "create_voice_channel", "create_stage_channel", "create_forum_channel", "create_announcement_channel", "edit_channel", "set_channel_permissions", "create_role", "edit_role", "delete_role", "create_role_hierarchy", "create_emoji", "create_webhook", "send_webhook_message", "ban_member", "kick_member", "timeout_member", "bulk_delete_messages", "create_scheduled_event", "create_invite", "create_thread", "create_automod_rule" ]