Skip to main content
Glama

discord_get_role_members

Retrieve all Discord server members assigned to a specific role by providing guild and role IDs.

Instructions

List all members that have a specific role.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guild_idYes
role_idYes

Implementation Reference

  • The handler implementation for the `discord_get_role_members` tool which fetches guild members and lists them by role ID.
    case "discord_get_role_members": {
      const guild = await discord.guilds.fetch(validateId(args.guild_id, "guild_id"));
      await guild.members.list({ limit: 1000 });
      const role = await guild.roles.fetch(args.role_id as string) as Role;
      const members = role.members.map((m) => ({ id: m.id, username: m.user.tag, nickname: m.nickname }));
      return { content: [{ type: "text", text: JSON.stringify(members, null, 2) }] };
    }
  • The schema definition for the `discord_get_role_members` tool, specifying the required `guild_id` and `role_id` parameters.
    {
      name: "discord_get_role_members",
      description: "List all members that have a specific role.",
      inputSchema: {
        type: "object",
        properties: {
          guild_id: { type: "string" },
          role_id: { type: "string" },
        },
        required: ["guild_id", "role_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