discord_reply_to_forum
Adds a reply to an existing Discord forum post or thread by providing the thread ID and message content.
Instructions
Adds a reply to an existing forum post or thread
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| threadId | Yes | ||
| message | Yes |
Implementation Reference
- src/tools/forum.ts:176-223 (handler)The replyToForumHandler function that executes the discord_reply_to_forum tool logic. It fetches a thread, validates it supports sending messages, and sends the reply.
export const replyToForumHandler: ToolHandler = async (args, { client }) => { const { threadId, message } = ReplyToForumSchema.parse(args); try { if (!client.isReady()) { return { content: [{ type: 'text', text: 'Discord client not logged in.' }], isError: true, }; } const thread = await client.channels.fetch(threadId); if (!thread?.isThread()) { return { content: [ { type: 'text', text: `Cannot find thread with ID: ${threadId}` }, ], isError: true, }; } if (!('send' in thread)) { return { content: [ { type: 'text', text: 'This thread does not support sending messages', }, ], isError: true, }; } // Send the reply const sentMessage = await thread.send(message); return { content: [ { type: 'text', text: `Successfully replied to forum post. Message ID: ${sentMessage.id}`, }, ], }; } catch (error) { return handleDiscordError(error); } }; - src/schemas.ts:27-30 (schema)ReplyToForumSchema Zod schema defining input validation: threadId (string) and message (string), both required.
export const ReplyToForumSchema = z.object({ threadId: z.string(), message: z.string(), }); - src/server.ts:128-131 (registration)Registration of discord_reply_to_forum in the MCP server's CallToolRequestSchema handler, routing to replyToForumHandler.
case 'discord_reply_to_forum': this.logClientState('before discord_reply_to_forum handler'); toolResponse = await replyToForumHandler(args, this.toolContext); return toolResponse; - src/tool-list.ts:106-117 (registration)Tool definition/registration in the tool list with name, description, and input schema for discord_reply_to_forum.
{ name: 'discord_reply_to_forum', description: 'Adds a reply to an existing forum post or thread', inputSchema: { type: 'object', properties: { threadId: { type: 'string' }, message: { type: 'string' }, }, required: ['threadId', 'message'], }, },