Skip to main content
Glama
scarecr0w12

discord-mcp

list_members

Retrieve member information from a Discord server by specifying the guild ID, with options to control the number of members fetched.

Instructions

List members in a Discord server (fetches up to 1000 members)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)
limitNoMaximum number of members to fetch (default: 100, max: 1000)

Implementation Reference

  • The handler function that executes the list_members tool: fetches up to 1000 members from the specified Discord guild using the Discord client, maps member data to a structured format including ID, username, display name, nickname, join date, roles, bot status, and avatar, handles errors, and returns the JSON-formatted list.
    async ({ guildId, limit = 100 }) => {
      const result = await withErrorHandling(async () => {
        const client = await getDiscordClient();
        const guild = await client.guilds.fetch(guildId);
        const members = await guild.members.fetch({ limit: Math.min(limit, 1000) });
    
        return members.map((member) => ({
          id: member.id,
          username: member.user.username,
          displayName: member.displayName,
          nickname: member.nickname,
          joinedAt: member.joinedAt?.toISOString(),
          roles: member.roles.cache.map((r) => ({ id: r.id, name: r.name })),
          isBot: member.user.bot,
          avatar: member.displayAvatarURL(),
        }));
      });
    
      if (!result.success) {
        return { content: [{ type: 'text', text: result.error }], isError: true };
      }
    
      return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] };
    }
  • Zod input schema defining parameters for the list_members tool: required guildId (string) and optional limit (number, default 100).
    {
      guildId: z.string().describe('The ID of the server (guild)'),
      limit: z.number().optional().describe('Maximum number of members to fetch (default: 100, max: 1000)'),
    },
  • Registration of the list_members tool via server.tool(), including name, description, input schema, and inline handler function.
    server.tool(
      'list_members',
      'List members in a Discord server (fetches up to 1000 members)',
      {
        guildId: z.string().describe('The ID of the server (guild)'),
        limit: z.number().optional().describe('Maximum number of members to fetch (default: 100, max: 1000)'),
      },
      async ({ guildId, limit = 100 }) => {
        const result = await withErrorHandling(async () => {
          const client = await getDiscordClient();
          const guild = await client.guilds.fetch(guildId);
          const members = await guild.members.fetch({ limit: Math.min(limit, 1000) });
    
          return members.map((member) => ({
            id: member.id,
            username: member.user.username,
            displayName: member.displayName,
            nickname: member.nickname,
            joinedAt: member.joinedAt?.toISOString(),
            roles: member.roles.cache.map((r) => ({ id: r.id, name: r.name })),
            isBot: member.user.bot,
            avatar: member.displayAvatarURL(),
          }));
        });
    
        if (!result.success) {
          return { content: [{ type: 'text', text: result.error }], isError: true };
        }
    
        return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] };
      }
    );
  • src/index.ts:13-56 (registration)
    Top-level import (line 13) and invocation (line 56) of registerMemberTools(server), which registers the list_members tool (and other member tools) with the MCP server.
    import { registerMemberTools } from './tools/member-tools.js';
    import { registerRoleTools } from './tools/role-tools.js';
    import { registerPermissionTools } from './tools/permission-tools.js';
    import { registerMessageTools } from './tools/message-tools.js';
    import { registerEmojiTools } from './tools/emoji-tools.js';
    import { registerWebhookTools } from './tools/webhook-tools.js';
    import { registerInviteTools } from './tools/invite-tools.js';
    import { registerEventTools } from './tools/event-tools.js';
    import { registerThreadTools } from './tools/thread-tools.js';
    import { registerAuditTools } from './tools/audit-tools.js';
    import { registerDiscordPrompts } from './prompts/discord-prompts.js';
    
    /**
     * Discord MCP Server
     *
     * This MCP server provides comprehensive tools for managing Discord servers.
     * It requires the DISCORD_BOT_TOKEN environment variable to be set.
     *
     * Available tool categories:
     * - Server Management: list_servers, get_server_info, modify_server
     * - Channel Management: list_channels, get_channel_info, create_channel, delete_channel, modify_channel
     * - Member Management: list_members, get_member_info, modify_member, kick_member, ban_member, unban_member, list_bans
     * - Role Management: list_roles, get_role_info, create_role, delete_role, modify_role, assign_role, remove_role
     * - Permission Management: get_channel_permissions, set_channel_permission, delete_channel_permission, list_permissions, sync_channel_permissions
     * - Message Management: send_message, get_messages, edit_message, delete_message, bulk_delete_messages, pin/unpin, reactions
     * - Emoji & Sticker Management: list_emojis, create_emoji, delete_emoji, modify_emoji, sticker operations
     * - Webhook Management: list_channel_webhooks, list_guild_webhooks, create_webhook, delete_webhook, modify_webhook, send_webhook_message
     * - Invite Management: list_invites, get_invite_info, create_invite, delete_invite
     * - Event Management: list_events, get_event_info, create_event, modify_event, delete_event, get_event_subscribers
     * - Thread Management: list_threads, create_thread, create_forum_post, modify_thread, delete_thread, join/leave, member management
     * - Audit & Moderation: get_audit_logs, list_audit_log_types, list_automod_rules, get_automod_rule, delete_automod_rule, toggle_automod_rule
     */
    
    // Create a configured MCP server instance
    function createMcpServer(): McpServer {
      const server = new McpServer({
        name: 'discord-mcp',
        version: '1.1.0',
      });
    
      // Register all tool categories
      registerServerTools(server);
      registerChannelTools(server);
      registerMemberTools(server);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden but provides minimal behavioral context. It mentions the 1000-member limit, which is useful, but lacks details on permissions required, rate limits, pagination, return format, or whether it's read-only (implied by 'list' but not explicit).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It front-loads the core purpose and includes a key constraint (1000-member limit) without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple read operation with no annotations and no output schema, the description is minimally adequate. It covers the basic action and a constraint, but lacks details on permissions, rate limits, or return structure, leaving gaps for an agent to infer.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents both parameters. The description adds no additional parameter semantics beyond what's in the schema (e.g., it doesn't explain guildId format or limit behavior further), meeting the baseline for high coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('List') and resource ('members in a Discord server'), making the purpose unambiguous. It distinguishes from siblings like 'get_member_info' (single member) and 'list_roles' (different resource), though it doesn't explicitly contrast with them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives is provided. While the description mentions fetching up to 1000 members, it doesn't specify scenarios (e.g., bulk analysis vs. single lookups) or compare with other list tools like 'list_roles' or 'list_channels'.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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

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