discord_get_forum_post
Retrieve forum post details and messages from Discord to access and analyze discussion content in threads.
Instructions
Retrieves details about a forum post including its messages
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| threadId | Yes |
Implementation Reference
- src/index.ts:692-736 (handler)The main execution logic for the discord_get_forum_post tool. Fetches the Discord thread by threadId, retrieves up to 10 recent messages, formats details including messages, and returns as JSON.case "discord_get_forum_post": { const { threadId } = GetForumPostSchema.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 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 { content: [{ type: "text", text: `Failed to fetch forum post: ${error}` }], isError: true }; } }
- src/index.ts:159-161 (schema)Zod input validation schema for the tool, defining the required 'threadId' parameter.const GetForumPostSchema = z.object({ threadId: z.string() });
- src/index.ts:255-265 (registration)MCP tool registration entry listing the tool's name, description, and input schema in the server's tool list.{ name: "discord_get_forum_post", description: "Retrieves details about a forum post including its messages", inputSchema: { type: "object", properties: { threadId: { type: "string" } }, required: ["threadId"] } },