discord_get_forum_post
Retrieve detailed information about a specific forum post, including its messages, by providing the thread ID. Ideal for managing and analyzing Discord forum content efficiently.
Instructions
Retrieves details about a forum post including its messages
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| threadId | Yes |
Input Schema (JSON Schema)
{
"properties": {
"threadId": {
"type": "string"
}
},
"required": [
"threadId"
],
"type": "object"
}
Implementation Reference
- src/tools/forum.ts:104-146 (handler)The core handler function that fetches a Discord forum post (thread) by ID, retrieves its recent messages (limit 10), formats the details, and returns them as JSON. Includes error handling and client readiness check.export const getForumPostHandler: ToolHandler = async (args, { client }) => { const { threadId } = GetForumPostSchema.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 }; } // Get messages from the thread const messages = await thread.messages.fetch({ limit: 10 }); const threadDetails = { id: thread.id, name: thread.name, parentId: thread.parentId, messageCount: messages.size, createdAt: thread.createdAt, messages: messages.map(msg => ({ id: msg.id, content: msg.content, author: msg.author.tag, createdAt: msg.createdAt })) }; return { content: [{ type: "text", text: JSON.stringify(threadDetails, null, 2) }] }; } catch (error) { return handleDiscordError(error); } };
- src/toolList.ts:94-104 (schema)MCP tool schema definition: specifies name, description, and input schema requiring 'threadId' string.{ name: "discord_get_forum_post", description: "Retrieves details about a forum post including its messages", inputSchema: { type: "object", properties: { threadId: { type: "string" } }, required: ["threadId"] } },
- src/server.ts:108-111 (registration)Tool dispatch/registration in the MCP server request handler switch statement: calls getForumPostHandler for tool name 'discord_get_forum_post'.case "discord_get_forum_post": this.logClientState("before discord_get_forum_post handler"); toolResponse = await getForumPostHandler(args, this.toolContext); return toolResponse;
- src/schemas.ts:24-26 (schema)Zod input validation schema used in the handler to parse arguments, matching the MCP inputSchema.export const GetForumPostSchema = z.object({ threadId: z.string() });
- src/tools/tools.ts:40-45 (registration)Re-export of the getForumPostHandler from forum.ts, making it available for import in server.ts.export { loginHandler, sendMessageHandler, getForumChannelsHandler, createForumPostHandler, getForumPostHandler,