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
| Name | Required | Description | Default |
|---|---|---|---|
| threadId | Yes | ||
| reason | No |
Implementation Reference
- src/tools/forum.ts:225-263 (handler)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); } };
- src/schemas.ts:92-95 (schema)Zod schema for input validation of the tool: requires threadId, optional reason.export const DeleteForumPostSchema = z.object({ threadId: z.string(), reason: z.string().optional(), });
- src/tool-list.ts:217-228 (registration)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;
- src/tools/tools.ts:11-16 (helper)Re-export of forum tool handlers including deleteForumPostHandler for centralized import in server and transport.createForumPostHandler, deleteForumPostHandler, getForumChannelsHandler, getForumPostHandler, replyToForumHandler, } from './forum.js';