Skip to main content
Glama
jar285

MCP-Discord

by jar285

discord_reply_to_forum

Add a reply to an existing Discord forum thread by providing the thread ID and message content.

Instructions

Adds a reply to an existing forum post or thread

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
threadIdYes
messageYes

Implementation Reference

  • The main execution logic for the 'discord_reply_to_forum' tool. Fetches the specified thread by ID, validates it supports sending messages, and sends the provided message as a reply.
    case "discord_reply_to_forum": {
      const { threadId, message } = ReplyToForumSchema.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
          };
        }
    
        if (!('send' in thread)) {
          return {
            content: [{ type: "text", text: `This thread does not support sending messages` }],
            isError: true
          };
        }
    
        // Send the reply
        const sentMessage = await thread.send(message);
    
        return {
          content: [{ 
            type: "text", 
            text: `Successfully replied to forum post. Message ID: ${sentMessage.id}` 
          }]
        };
      } catch (error) {
        return {
          content: [{ type: "text", text: `Failed to reply to forum post: ${error}` }],
          isError: true
        };
      }
    }
  • Zod input validation schema for the tool, defining required string parameters 'threadId' and 'message'.
    const ReplyToForumSchema = z.object({
        threadId: z.string(),
        message: z.string()
    });
  • src/index.ts:266-277 (registration)
    Tool registration in the MCP server's tool list, providing name, description, and JSON schema for inputs.
    {
      name: "discord_reply_to_forum",
      description: "Adds a reply to an existing forum post or thread",
      inputSchema: {
        type: "object",
        properties: {
          threadId: { type: "string" },
          message: { type: "string" }
        },
        required: ["threadId", "message"]
      }
    },

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