Skip to main content
Glama
scarecr0w12

discord-mcp

delete_channel

Remove a channel from a Discord server by specifying the server and channel IDs. Provide an optional reason for the deletion.

Instructions

Delete a channel from a Discord server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)
channelIdYesThe ID of the channel to delete
reasonNoReason for deleting the channel

Implementation Reference

  • The core handler function for the 'delete_channel' tool. It fetches the Discord guild and channel using the provided IDs, deletes the channel (optionally with a reason), and returns a success message with channel details or an error.
    async ({ guildId, channelId, reason }) => {
      const result = await withErrorHandling(async () => {
        const client = await getDiscordClient();
        const guild = await client.guilds.fetch(guildId);
        const channel = await guild.channels.fetch(channelId);
        if (!channel) throw new Error('Channel not found');
    
        const channelName = channel.name;
        await channel.delete(reason);
        return { channelId, channelName, message: 'Channel deleted 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 the parameters for the 'delete_channel' tool: required guildId and channelId, optional reason.
    {
      guildId: z.string().describe('The ID of the server (guild)'),
      channelId: z.string().describe('The ID of the channel to delete'),
      reason: z.string().optional().describe('Reason for deleting the channel'),
    },
  • src/index.ts:55-55 (registration)
    Top-level registration call in the main server setup that invokes registerChannelTools, which in turn registers the 'delete_channel' tool via server.tool().
    registerChannelTools(server);
  • Direct registration of the 'delete_channel' tool using server.tool(), including name, description, schema, and handler within the registerChannelTools function.
    // Delete a channel
    server.tool(
      'delete_channel',
      'Delete a channel from a Discord server',
      {
        guildId: z.string().describe('The ID of the server (guild)'),
        channelId: z.string().describe('The ID of the channel to delete'),
        reason: z.string().optional().describe('Reason for deleting the channel'),
      },
      async ({ guildId, channelId, reason }) => {
        const result = await withErrorHandling(async () => {
          const client = await getDiscordClient();
          const guild = await client.guilds.fetch(guildId);
          const channel = await guild.channels.fetch(channelId);
          if (!channel) throw new Error('Channel not found');
    
          const channelName = channel.name;
          await channel.delete(reason);
          return { channelId, channelName, message: 'Channel deleted successfully' };
        });
    
        if (!result.success) {
          return { content: [{ type: 'text', text: result.error }], isError: true };
        }
    
        return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] };
      }
    );
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 'Delete' implies a destructive mutation, the description doesn't specify that this action is permanent, requires specific permissions, or what happens to existing messages in the channel. For a destructive operation with zero annotation coverage, this represents a significant gap in behavioral transparency.

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 that states exactly what the tool does with zero wasted words. It's appropriately sized for a straightforward destructive operation and is front-loaded with the core action.

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 mutation tool with no annotations and no output schema, the description is insufficiently complete. It doesn't address critical context like permission requirements, permanence of the action, error conditions, or what happens to channel content. Given the complexity of a Discord channel deletion and the lack of structured safety information, the description should provide more behavioral guidance.

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 three parameters (guildId, channelId, reason) with clear descriptions. The description doesn't add any additional parameter semantics beyond what's in the schema, such as format requirements for IDs or when to provide a reason. The baseline score of 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 ('Delete') and target resource ('a channel from a Discord server'), making the purpose immediately understandable. However, it doesn't differentiate this tool from other deletion tools like delete_message, delete_role, or delete_thread, which all perform similar destructive operations on different Discord resources.

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. It doesn't mention prerequisites (like needing appropriate permissions), consequences (channels are permanently removed), or when other tools might be more appropriate (like modify_channel for renaming instead of deleting).

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