discord_delete_channel
Remove Discord channels via MCP-Discord by specifying the channel ID and an optional reason for deletion, streamlining channel management tasks.
Instructions
Deletes a Discord channel with an optional reason
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channelId | Yes | ||
| reason | No |
Implementation Reference
- src/index.ts:819-860 (handler)Handler function that executes the discord_delete_channel tool: fetches the channel, checks permissions, deletes it with optional reason, and returns success/error response.case "discord_delete_channel": { const { channelId, reason } = DeleteChannelSchema.parse(args); try { if (!client.isReady()) { return { content: [{ type: "text", text: "Discord client not logged in. Please use discord_login tool first." }], isError: true }; } const channel = await client.channels.fetch(channelId); if (!channel) { return { content: [{ type: "text", text: `Cannot find channel with ID: ${channelId}` }], isError: true }; } // Check if channel can be deleted (has delete method) if (!('delete' in channel)) { return { content: [{ type: "text", text: `This channel type does not support deletion or the bot lacks permissions` }], isError: true }; } // Delete the channel await channel.delete(reason || "Channel deleted via API"); return { content: [{ type: "text", text: `Successfully deleted channel with ID: ${channelId}` }] }; } catch (error) { return { content: [{ type: "text", text: `Failed to delete channel: ${error}` }], isError: true }; } }
- src/index.ts:174-177 (schema)Zod schema defining the input parameters for the discord_delete_channel tool: required channelId and optional reason.const DeleteChannelSchema = z.object({ channelId: z.string(), reason: z.string().optional() });
- src/index.ts:291-301 (registration)Tool registration in the MCP server's tool list, specifying name, description, and input schema.{ name: "discord_delete_channel", description: "Deletes a Discord channel with an optional reason", inputSchema: { type: "object", properties: { channelId: { type: "string" }, reason: { type: "string" } }, required: ["channelId"] }