Skip to main content
Glama

discord_delete_forum_post

Remove a Discord forum post or thread by specifying the thread ID and an optional deletion reason. Part of the MCP-Discord server’s toolkit for managing forum interactions.

Instructions

Deletes a forum post or thread with an optional reason

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
reasonNo
threadIdYes

Implementation Reference

  • The core execution logic for the discord_delete_forum_post tool. Parses input arguments, validates Discord client readiness, fetches the target thread, and deletes it.
    export const deleteForumPostHandler: ToolHandler = async (args, { client }) => {
      const { threadId, reason } = DeleteForumPostSchema.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 forum post/thread with ID: ${threadId}` }],
            isError: true
          };
        }
    
        // Delete the forum post/thread
        await thread.delete(reason || "Forum post deleted via API");
    
        return {
          content: [{ 
            type: "text", 
            text: `Successfully deleted forum post/thread with ID: ${threadId}` 
          }]
        };
      } catch (error) {
        return handleDiscordError(error);
      }
    }; 
  • MCP tool schema definition including name, description, and input schema for the discord_delete_forum_post tool.
    {
      name: "discord_delete_forum_post",
      description: "Deletes a forum post or thread with an optional reason",
      inputSchema: {
        type: "object",
        properties: {
          threadId: { type: "string" },
          reason: { type: "string" }
        },
        required: ["threadId"]
      }
  • Zod validation schema used within the handler to parse and validate input arguments.
    export const DeleteForumPostSchema = z.object({
        threadId: z.string(),
        reason: z.string().optional()
    });
  • src/server.ts:118-121 (registration)
    Switch case registration in the main server request handler that routes calls to discord_delete_forum_post to the deleteForumPostHandler function.
    case "discord_delete_forum_post":
      this.logClientState("before discord_delete_forum_post handler");
      toolResponse = await deleteForumPostHandler(args, this.toolContext);
      return toolResponse;

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