Skip to main content
Glama

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
NameRequiredDescriptionDefault
guild_idYes

Implementation Reference

  • 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) }] };
    }
  • 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"],
      },
    },

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/PaSympa/discord-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server