Skip to main content
Glama

delete_role

Remove a role from a Discord server to manage permissions and organize members. Specify the role ID to delete it, optionally providing a server ID and reason for the action.

Instructions

Delete a role from the server.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
role_idYes
server_idNo
reasonNo

Implementation Reference

  • The handler function that implements the delete_role tool logic: fetches the guild by server_id, retrieves the role by role_id, deletes the role if found, and returns a confirmation message.
    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}" )]
  • Registers the 'delete_role' tool in the MCP server with its description and input schema defining required parameters: server_id and role_id.
    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 the JSON structure expected for arguments.
    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"] } ),
  • Includes 'delete_role' in the list of advanced tools that are routed to their respective handlers in AdvancedToolHandlers.
    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" ]

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