discord_list_channels
Retrieve all Discord channels organized by category for a specific guild using the discord-mcp server.
Instructions
List all channels in a guild grouped by category.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| guild_id | Yes |
Implementation Reference
- src/tools/discovery.ts:71-92 (handler)The handler implementation for the 'discord_list_channels' tool, which fetches channels in a guild and organizes them by their parent category.
case "discord_list_channels": { const guild = await discord.guilds.fetch(validateId(args.guild_id, "guild_id")); await guild.channels.fetch(); const categories = guild.channels.cache .filter((c) => c.type === ChannelType.GuildCategory) .sort((a, b) => (a as CategoryChannel).position - (b as CategoryChannel).position); const result: Record<string, unknown[]> = { "No Category": [] }; categories.forEach((cat) => { result[cat.name] = []; }); guild.channels.cache .filter((c) => c.type !== ChannelType.GuildCategory) .sort((a, b) => (a as GuildChannel).position - (b as GuildChannel).position) .forEach((ch) => { const entry = { id: ch.id, name: ch.name, type: ChannelType[ch.type] }; const parentName = (ch as GuildChannel).parent?.name ?? "No Category"; if (!result[parentName]) result[parentName] = []; result[parentName].push(entry); }); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } - src/tools/discovery.ts:22-29 (schema)Tool definition and input schema for 'discord_list_channels'.
name: "discord_list_channels", description: "List all channels in a guild grouped by category.", inputSchema: { type: "object", properties: { guild_id: { type: "string" } }, required: ["guild_id"], }, },