discord_get_forum_post
Retrieve forum post details and messages from Discord by providing the thread ID for analysis or reference.
Instructions
Retrieves details about a forum post including its messages
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| threadId | Yes |
Implementation Reference
- src/tools/forum.ts:130-174 (handler)The core handler function implementing the discord_get_forum_post tool. Fetches a forum thread by ID, retrieves recent messages, and returns formatted details.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/tool-list.ts:95-104 (schema)The tool schema definition including name, description, and input schema (requires threadId) used for MCP tools/list response.{ 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:123-126 (registration)Registration/dispatch of the tool handler in the main MCP server's call_tool request handler switch statement.case 'discord_get_forum_post': this.logClientState('before discord_get_forum_post handler'); toolResponse = await getForumPostHandler(args, this.toolContext); return toolResponse;
- src/transport.ts:325-327 (registration)Additional dispatch of the tool handler in the HTTP transport layer's method switch for legacy tool calls.case 'discord_get_forum_post': result = await getForumPostHandler(params, this.toolContext!); break;
- src/transport.ts:513-515 (registration)Dispatch of the tool handler in the HTTP transport layer for modern tools/call method format.case 'discord_get_forum_post': result = await getForumPostHandler(toolArgs, this.toolContext!); break;