Skip to main content
Glama
jar285

MCP-Discord

by jar285

discord_create_forum_post

Create a new post in a Discord forum channel with a title, content, and optional tags for organized discussions. Ideal for AI assistants or users managing forums on MCP-Discord servers.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYes
forumChannelIdYes
tagsNo
titleYes

Implementation Reference

  • The handler function that executes the discord_create_forum_post tool. It parses input using CreateForumPostSchema, fetches the forum channel, handles tags by matching names to IDs, creates the thread/post with Discord.js, and returns success or error.
    case "discord_create_forum_post": { const { forumChannelId, title, content, tags } = CreateForumPostSchema.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 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: content }, appliedTags: selectedTagIds.length > 0 ? selectedTagIds : undefined }); return { content: [{ type: "text", text: `Successfully created forum post "${title}" with ID: ${thread.id}` }] }; } catch (error) { return { content: [{ type: "text", text: `Failed to create forum post: ${error}` }], isError: true }; } }
  • Zod schema for input validation of the discord_create_forum_post tool, defining required fields forumChannelId, title, content, and optional tags array.
    const CreateForumPostSchema = z.object({ forumChannelId: z.string(), title: z.string(), content: z.string(), tags: z.array(z.string()).optional() });
  • src/index.ts:239-254 (registration)
    MCP tool registration for discord_create_forum_post, including name, description, and inputSchema matching the Zod schema.
    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"] } },

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