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
| Name | Required | Description | Default |
|---|---|---|---|
| reason | No | ||
| threadId | Yes |
Input Schema (JSON Schema)
{
"properties": {
"reason": {
"type": "string"
},
"threadId": {
"type": "string"
}
},
"required": [
"threadId"
],
"type": "object"
}
Implementation Reference
- src/tools/forum.ts:188-219 (handler)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); } };
- src/toolList.ts:213-223 (schema)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"] }
- src/schemas.ts:93-96 (schema)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;