Skip to main content
Glama

discord_create_forum_post

Create organized discussions in Discord forum channels by posting new topics with relevant tags to categorize conversations effectively.

Instructions

Creates a new post in a Discord forum channel with optional tags

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
forumChannelIdYes
titleYes
contentYes
tagsNo

Implementation Reference

  • The core handler function that implements the discord_create_forum_post tool logic. It validates input with Zod, fetches the forum channel, handles tags, creates the thread/post, and returns success/error responses.
    export const createForumPostHandler: ToolHandler = async (args, { client }) => { const { forumChannelId, title, content, tags } = CreateForumPostSchema.parse(args); try { if (!client.isReady()) { return { content: [{ type: 'text', text: 'Discord client not logged in.' }], isError: true, }; } const channel = await client.channels.fetch(forumChannelId); if (!channel || channel.type !== ChannelType.GuildForum) { return { content: [ { type: 'text', text: `Channel ID ${forumChannelId} is not a forum channel.`, }, ], isError: true, }; } const forumChannel = channel as ForumChannel; // Get available tags in the forum const availableTags = forumChannel.availableTags; let selectedTagIds: string[] = []; // If tags are provided, find their IDs if (tags && tags.length > 0) { selectedTagIds = availableTags .filter((tag) => tags.includes(tag.name)) .map((tag) => tag.id); } // Create the forum post const thread = await forumChannel.threads.create({ name: title, message: { content, }, appliedTags: selectedTagIds.length > 0 ? selectedTagIds : undefined, }); return { content: [ { type: 'text', text: `Successfully created forum post "${title}" with ID: ${thread.id}`, }, ], }; } catch (error) { return handleDiscordError(error); } };
  • The JSON input schema definition for the tool, used by MCP for tool listing and validation.
    { name: 'discord_create_forum_post', description: 'Creates a new post in a Discord forum channel with optional tags', inputSchema: { type: 'object', properties: { forumChannelId: { type: 'string' }, title: { type: 'string' }, content: { type: 'string' }, tags: { type: 'array', items: { type: 'string' }, }, }, required: ['forumChannelId', 'title', 'content'], },
  • src/server.ts:118-121 (registration)
    Registration and dispatch in the main server handler switch statement, calling the createForumPostHandler.
    case 'discord_create_forum_post': this.logClientState('before discord_create_forum_post handler'); toolResponse = await createForumPostHandler(args, this.toolContext); return toolResponse;
  • src/server.ts:79-80 (registration)
    Tool list registration where the schema is provided to MCP clients.
    this.server.setRequestHandler(ListToolsRequestSchema, () => ({ tools: toolList,
  • Zod schema for internal input validation in the handler.
    export const CreateForumPostSchema = z.object({ forumChannelId: z.string(), title: z.string(), content: z.string(), tags: z.array(z.string()).optional(), });

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