discord_delete_channel
Delete a Discord channel by providing its channel ID, with an optional reason for the deletion.
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 for discord_delete_channel tool. Parses arguments using DeleteChannelSchema, checks client readiness, fetches the channel, verifies deletability, deletes the channel using Discord.js API, and returns success or 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 for input validation of discord_delete_channel tool, defining channelId as required string and reason as optional string.const DeleteChannelSchema = z.object({ channelId: z.string(), reason: z.string().optional() });
- src/index.ts:291-302 (registration)Tool registration in the listTools response, including name, description, and inputSchema matching DeleteChannelSchema.{ 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"] } },