Skip to main content
Glama

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

Implementation Reference

  • 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);
      }
    };
  • 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;
  • 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;
  • 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;

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

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