Skip to main content
Glama
jar285

MCP-Discord

by jar285

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
NameRequiredDescriptionDefault
threadIdYes

Implementation Reference

  • 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 }; } }
  • 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"] } },

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/jar285/mcp-discord'

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