Skip to main content
Glama
scarecr0w12

discord-mcp

ban_member

Remove disruptive users from a Discord server by banning members with options to delete recent messages and specify reasons for moderation actions.

Instructions

Ban a member from the server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)
userIdYesThe ID of the user to ban
deleteMessageSecondsNoNumber of seconds of messages to delete (0-604800)
reasonNoReason for the ban

Implementation Reference

  • Handler function that executes the ban_member tool: fetches the guild, prepares ban options, calls guild.members.ban(), handles errors with withErrorHandling, and returns JSON response.
      async ({ guildId, userId, deleteMessageSeconds, reason }) => {
        const result = await withErrorHandling(async () => {
          const client = await getDiscordClient();
          const guild = await client.guilds.fetch(guildId);
    
          const banOptions: { deleteMessageSeconds?: number; reason?: string } = {};
          if (deleteMessageSeconds !== undefined) {
            banOptions.deleteMessageSeconds = Math.min(Math.max(0, deleteMessageSeconds), 604800);
          }
          if (reason) banOptions.reason = reason;
    
          await guild.members.ban(userId, banOptions);
          return { userId, message: 'User banned successfully' };
        });
    
        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 ban_member tool: guildId (required), userId (required), deleteMessageSeconds (optional number), reason (optional string).
    {
      guildId: z.string().describe('The ID of the server (guild)'),
      userId: z.string().describe('The ID of the user to ban'),
      deleteMessageSeconds: z.number().optional().describe('Number of seconds of messages to delete (0-604800)'),
      reason: z.string().optional().describe('Reason for the ban'),
    },
  • Registration of the ban_member tool using server.tool() with name, description, input schema, and handler function.
    server.tool(
      'ban_member',
      'Ban a member from the server',
      {
        guildId: z.string().describe('The ID of the server (guild)'),
        userId: z.string().describe('The ID of the user to ban'),
        deleteMessageSeconds: z.number().optional().describe('Number of seconds of messages to delete (0-604800)'),
        reason: z.string().optional().describe('Reason for the ban'),
      },
      async ({ guildId, userId, deleteMessageSeconds, reason }) => {
        const result = await withErrorHandling(async () => {
          const client = await getDiscordClient();
          const guild = await client.guilds.fetch(guildId);
    
          const banOptions: { deleteMessageSeconds?: number; reason?: string } = {};
          if (deleteMessageSeconds !== undefined) {
            banOptions.deleteMessageSeconds = Math.min(Math.max(0, deleteMessageSeconds), 604800);
          }
          if (reason) banOptions.reason = reason;
    
          await guild.members.ban(userId, banOptions);
          return { userId, message: 'User banned successfully' };
        });
    
        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:56-56 (registration)
    Top-level call to registerMemberTools(server) in createMcpServer(), which includes registration of ban_member.
    registerMemberTools(server);
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. While 'Ban' implies a destructive action, it doesn't specify permanence, required permissions, rate limits, or what happens to the user's data. For a high-impact tool like banning, this lack of detail is a significant gap.

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, clear sentence with zero wasted words. It's front-loaded with the core action and target, making it immediately understandable without unnecessary elaboration.

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

Completeness2/5

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

For a destructive tool with no annotations and no output schema, the description is inadequate. It doesn't cover behavioral aspects like permissions, permanence, or error conditions, nor does it explain the relationship with sibling tools. Given the complexity and impact of banning, more context is needed.

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 already documents all parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema, such as explaining the implications of 'deleteMessageSeconds' or format expectations for 'reason'. Baseline 3 is appropriate when the schema does the heavy lifting.

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 action ('Ban') and target ('a member from the server'), making the purpose immediately understandable. However, it doesn't distinguish this tool from sibling tools like 'kick_member' or 'unban_member', which would require explicit differentiation to earn a perfect score.

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?

The description provides no guidance on when to use this tool versus alternatives like 'kick_member' or 'unban_member', nor does it mention prerequisites such as required permissions or server context. Without this contextual information, the agent lacks clear usage direction.

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