Skip to main content
Glama
jar285

MCP-Discord

by jar285

discord_delete_forum_post

Remove unwanted forum posts or threads from Discord with an optional reason for moderation.

Instructions

Deletes a forum post or thread with an optional reason

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
threadIdYes
reasonNo

Implementation Reference

  • Handler function that parses arguments using DeleteForumPostSchema, checks client readiness, fetches the thread by ID, verifies it's a thread, deletes it with optional reason, and returns success or error response.
    case "discord_delete_forum_post": {
      const { threadId, reason } = DeleteForumPostSchema.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 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 {
          content: [{ type: "text", text: `Failed to delete forum post: ${error}` }],
          isError: true
        };
      }
    }
  • Zod schema defining input parameters: threadId (required string), reason (optional string). Used for validation in the handler.
    const DeleteForumPostSchema = z.object({
        threadId: z.string(),
        reason: z.string().optional()
    });
  • src/index.ts:374-385 (registration)
    Tool registration in the listTools response, specifying name, description, and inputSchema matching the handler's expected arguments.
    {
      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"]
      }
    },

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