Skip to main content
Glama

discord_get_forum_channels

Retrieve all forum channels from a Discord server using the guild ID to manage discussions and organize community content.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYes

Implementation Reference

  • The core handler function that validates input with GetForumChannelsSchema, fetches the Discord guild, retrieves all channels, filters for forum channels (GuildForum type), formats their details (id, name, topic), and returns JSON stringified list or appropriate error messages.
    export const getForumChannelsHandler: ToolHandler = async ( args, { client } ) => { const { guildId } = GetForumChannelsSchema.parse(args); try { if (!client.isReady()) { return { content: [{ type: 'text', text: 'Discord client not logged in.' }], 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 handleDiscordError(error); } };
  • The tool's input schema definition used for MCP tool listing and validation, specifying guildId as required string parameter.
    { 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'], }, },
  • src/server.ts:110-116 (registration)
    Registration and dispatch in the MCP Server's CallToolRequestSchema handler switch statement, logging client state before calling the tool handler.
    case 'discord_get_forum_channels': this.logClientState('before discord_get_forum_channels handler'); toolResponse = await getForumChannelsHandler( args, this.toolContext ); return toolResponse;
  • Tool dispatch in StreamableHttpTransport's handleMcpRequest method for direct method calls, calling the handler after login check.
    case 'discord_get_forum_channels': result = await getForumChannelsHandler( params, this.toolContext! ); break;
  • Tool dispatch in StreamableHttpTransport for tools/call method format, calling the handler after login check.
    case 'discord_get_forum_channels': result = await getForumChannelsHandler( toolArgs, this.toolContext! ); break;

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

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