Skip to main content
Glama
jar285

MCP-Discord

by jar285

discord_get_forum_channels

Retrieve a list of all forum channels within a specified Discord server (guild) using this tool, enabling efficient management and organization of discussions.

Instructions

Lists all forum channels in a specified Discord server (guild)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYes

Implementation Reference

  • Zod schema for input validation of discord_get_forum_channels tool, requiring guildId string.
    const GetForumChannelsSchema = z.object({ guildId: z.string() });
  • src/index.ts:227-237 (registration)
    Tool registration in ListToolsRequestHandler, defining name, description, and inputSchema matching the schema.
    { name: "discord_get_forum_channels", description: "Lists all forum channels in a specified Discord server (guild)", inputSchema: { type: "object", properties: { guildId: { type: "string" } }, required: ["guildId"] } },
  • Handler function in CallToolRequestHandler switch case that fetches guild, filters forum channels (ChannelType.GuildForum), formats id/name/topic, returns JSON.
    case "discord_get_forum_channels": { const { guildId } = GetForumChannelsSchema.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 guild = await client.guilds.fetch(guildId); if (!guild) { return { content: [{ type: "text", text: `Cannot find guild with ID: ${guildId}` }], isError: true }; } // Fetch all channels from the guild const channels = await guild.channels.fetch(); // Filter to get only forum channels const forumChannels = channels.filter(channel => channel?.type === ChannelType.GuildForum); if (forumChannels.size === 0) { return { content: [{ type: "text", text: `No forum channels found in guild: ${guild.name}` }] }; } // Format forum channels information const forumInfo = forumChannels.map(channel => ({ id: channel.id, name: channel.name, topic: channel.topic || "No topic set" })); return { content: [{ type: "text", text: JSON.stringify(forumInfo, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Failed to fetch forum channels: ${error}` }], isError: true }; } }

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

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