Skip to main content
Glama

discord_list_roles

Retrieve all roles in a Discord guild with their permissions and member counts to manage server structure and access controls.

Instructions

List all roles in a guild with permissions and member count.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guild_idYes

Implementation Reference

  • The handler implementation for the discord_list_roles tool, which fetches the guild, retrieves roles, processes them, and returns them as a JSON string.
    case "discord_list_roles": {
      const guild = await discord.guilds.fetch(validateId(args.guild_id, "guild_id"));
      const roles = await guild.roles.fetch();
      const result = [...roles.values()]
        .filter((r) => r.name !== "@everyone")
        .sort((a, b) => b.position - a.position)
        .map((r) => ({
          id: r.id, name: r.name, color: r.hexColor, position: r.position,
          memberCount: r.members.size, permissions: serializePermissions(r.permissions),
          hoist: r.hoist, mentionable: r.mentionable,
        }));
      return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
    }
  • The definition and input schema for the discord_list_roles tool.
    {
      name: "discord_list_roles",
      description: "List all roles in a guild with permissions and member count.",
      inputSchema: {
        type: "object",
        properties: { guild_id: { type: "string" } },
        required: ["guild_id"],
      },
    },

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

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