discord_create_forum_post
Create a new thread in a Discord Forum channel with title, content, and optional tags. Use this tool to organize discussions and share information in structured forum spaces.
Instructions
Creates a new post (thread) inside a Discord Forum channel.
Parameters:
channel_id (string, required) : Snowflake ID of the Forum channel. Right-click the channel in Discord → Copy Channel ID.
title (string, required) : Post subject line. Max 100 characters.
content (string, required) : Body of the first message. Max 2000 characters. Supports Discord markdown (bold, italic, code blocks, etc.)
tag_ids (string[], optional): Array of Forum tag snowflake IDs to label the post.
Returns: A confirmation string with the post title and a direct URL, e.g.: "Forum post created successfully.\nTitle: My Post\nURL: https://discord.com/channels/GUILD/THREAD"
Errors:
"Invalid input …" — Input failed validation (wrong types, values out of range).
HTTP 401 Unauthorized — DISCORD_BOT_TOKEN is missing or invalid.
HTTP 403 Forbidden — The bot does not have permission to post in this channel.
HTTP 404 Not Found — channel_id does not exist or is not a Forum channel.
HTTP 400 Bad Request — Malformed payload (e.g. tag IDs that do not exist in the forum).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channel_id | Yes | Discord Forum channel ID (right-click channel → Copy Channel ID) | |
| title | Yes | Post subject / thread title (max 100 characters) | |
| content | Yes | First message body — supports Discord markdown (max 2000 characters) | |
| tag_ids | No | Optional array of Forum tag snowflake IDs to apply to the post |
Implementation Reference
- src/tools/discord/forum.ts:104-124 (handler)The main handler function for discord_create_forum_post tool. Validates input using Zod schema, calls createForumThread helper, and returns a success message with the post URL.
handler: async (input: unknown): Promise<string> => { const parseResult = CreateForumPostSchema.safeParse(input); if (!parseResult.success) { const issues = parseResult.error.issues .map((i) => ` - ${i.path.join('.')}: ${i.message}`) .join('\n'); throw new Error(`Invalid input for discord_create_forum_post:\n${issues}`); } const { channel_id, title, content, tag_ids } = parseResult.data as CreateForumPostInput; const thread = await createForumThread({ channelId: channel_id, title, content, tagIds: tag_ids, }); const url = `https://discord.com/channels/${thread.guild_id}/${thread.id}`; return `Forum post created successfully.\nTitle: ${title}\nURL: ${url}`; }, - src/tools/discord/forum.ts:14-33 (schema)Zod schema (CreateForumPostSchema) for runtime input validation. Defines channel_id, title, content, and optional tag_ids with validation rules.
const CreateForumPostSchema = z.object({ channel_id: z .string() .min(1, 'channel_id must not be empty') .describe('Discord Forum channel ID'), title: z .string() .min(1, 'title must not be empty') .max(100, 'title must be at most 100 characters') .describe('Thread title (post subject)'), content: z .string() .min(1, 'content must not be empty') .max(2000, 'content must be at most 2000 characters') .describe('Post body (supports Discord markdown)'), tag_ids: z .array(z.string()) .optional() .describe('Optional array of Forum tag snowflake IDs to apply'), }); - src/tools/discord/helpers.ts:71-91 (helper)The createForumThread helper function that makes the actual Discord REST API POST request to create a forum thread.
export async function createForumThread( params: CreateForumThreadParams, ): Promise<DiscordThread> { const { channelId, title, content, tagIds, autoArchiveDuration = 4320 } = params; const body: Record<string, unknown> = { name: title, message: { content }, auto_archive_duration: autoArchiveDuration, }; if (tagIds !== undefined && tagIds.length > 0) { body['applied_tags'] = tagIds; } return httpRequest<DiscordThread>(`${DISCORD_API_BASE}/channels/${channelId}/threads`, { method: 'POST', headers: buildDiscordHeaders(), body, }); } - src/tools/discord/index.ts:12-15 (registration)Registration point where discordCreateForumPostTool is imported and exported as part of the discordTools array.
import { discordCreateForumPostTool } from './forum.js'; /** All Discord-domain MCP tools. Consumed by src/tools/index.ts. */ export const discordTools = [discordCreateForumPostTool];