Skip to main content
Glama

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

NameRequiredDescriptionDefault
threadIdYes

Input Schema (JSON Schema)

{ "properties": { "threadId": { "type": "string" } }, "required": [ "threadId" ], "type": "object" }

Implementation Reference

  • 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); } };
  • 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;
  • Zod input validation schema used in the handler to parse arguments, matching the MCP inputSchema.
    export const GetForumPostSchema = z.object({ threadId: z.string() });
  • Re-export of the getForumPostHandler from forum.ts, making it available for import in server.ts.
    export { loginHandler, sendMessageHandler, getForumChannelsHandler, createForumPostHandler, getForumPostHandler,

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/barryyip0625/mcp-discord'

If you have feedback or need assistance with the MCP directory API, please join our Discord server