discord_get_forum_post
Retrieve details and messages from a specific Discord forum post using its thread ID.
Instructions
Retrieves details about a forum post including its messages
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| threadId | Yes |
Implementation Reference
- src/tools/forum.ts:130-174 (handler)The main handler function for discord_get_forum_post. Validates input via GetForumPostSchema, checks client readiness, fetches the thread by threadId, retrieves up to 10 messages, and returns thread details (id, name, parentId, messageCount, createdAt, messages).
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?.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/schemas.ts:23-25 (schema)Zod schema for input validation of discord_get_forum_post. Expects a single required field: threadId (string).
export const GetForumPostSchema = z.object({ threadId: z.string(), }); - src/tool-list.ts:96-105 (registration)Registration of the tool in the tool list. Defines tool name, description, and JSON Schema input schema with required threadId parameter.
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/tools/tools.ts:10-16 (helper)Re-export of getForumPostHandler from forum.ts, used as a barrel export for all tool handlers.
export { createForumPostHandler, deleteForumPostHandler, getForumChannelsHandler, getForumPostHandler, replyToForumHandler, } from './forum.js'; - src/server.ts:123-126 (registration)Routing case in server.ts that dispatches the 'discord_get_forum_post' tool request to getForumPostHandler.
case 'discord_get_forum_post': this.logClientState('before discord_get_forum_post handler'); toolResponse = await getForumPostHandler(args, this.toolContext); return toolResponse;