discord_reply_to_forum
Enables posting replies to Discord forum threads by specifying the thread ID and message content for effective communication and engagement.
Instructions
Adds a reply to an existing forum post or thread
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | Yes | ||
| threadId | Yes |
Input Schema (JSON Schema)
{
"properties": {
"message": {
"type": "string"
},
"threadId": {
"type": "string"
}
},
"required": [
"threadId",
"message"
],
"type": "object"
}
Implementation Reference
- src/tools/forum.ts:148-186 (handler)The core handler function that validates input with ReplyToForumSchema, fetches the forum thread, checks permissions, sends the reply message, and returns success or error response.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 || !(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:28-31 (schema)Zod schema used for input validation in the handler (threadId and message are required strings).export const ReplyToForumSchema = z.object({ threadId: z.string(), message: z.string() });
- src/server.ts:113-116 (registration)Switch case registration in the MCP server that dispatches tool calls to the replyToForumHandler.case "discord_reply_to_forum": this.logClientState("before discord_reply_to_forum handler"); toolResponse = await replyToForumHandler(args, this.toolContext); return toolResponse;
- src/toolList.ts:105-116 (schema)Tool definition in the exported toolList array, including name, description, and input schema advertised to MCP clients via listTools.{ 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"] } },
- src/tools/tools.ts:46-46 (registration)Re-export of the replyToForumHandler from forum.ts to make it available for import in server.ts.replyToForumHandler,