Skip to main content
Glama

discord_delete_forum_post

Delete Discord forum posts or threads to remove unwanted content. Specify a thread ID and optional reason for moderation.

Instructions

Deletes a forum post or thread with an optional reason

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
threadIdYes
reasonNo

Implementation Reference

  • The main handler function that executes the deletion of a Discord forum post/thread. Validates input, checks client readiness, fetches the thread, deletes it, and returns success or error response.
    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?.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);
      }
    };
  • Zod schema for input validation of the tool: requires threadId, optional reason.
    export const DeleteForumPostSchema = z.object({
      threadId: z.string(),
      reason: z.string().optional(),
    });
  • Tool definition in the toolList array used for list_tools endpoint, including name, description, and input schema.
    {
      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'],
      },
    },
  • src/server.ts:133-136 (registration)
    Dispatch registration in server.ts switch statement that routes tool calls to the deleteForumPostHandler.
    case 'discord_delete_forum_post':
      this.logClientState('before discord_delete_forum_post handler');
      toolResponse = await deleteForumPostHandler(args, this.toolContext);
      return toolResponse;
  • Re-export of forum tool handlers including deleteForumPostHandler for centralized import in server and transport.
      createForumPostHandler,
      deleteForumPostHandler,
      getForumChannelsHandler,
      getForumPostHandler,
      replyToForumHandler,
    } from './forum.js';

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