discord_remove_reaction
Remove a specific emoji reaction from a Discord message by specifying the channel ID, message ID, and emoji through the MCP-Discord server.
Instructions
Removes a specific emoji reaction from a Discord message
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channelId | Yes | ||
| emoji | Yes | ||
| messageId | Yes | ||
| userId | No |
Implementation Reference
- src/index.ts:1075-1139 (handler)Handler for discord_remove_reaction tool: validates args, fetches channel and message, locates the reaction, removes it for specified user or bot, returns success/error response.case "discord_remove_reaction": { const { channelId, messageId, emoji, userId } = RemoveReactionSchema.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 channel = await client.channels.fetch(channelId); if (!channel || !channel.isTextBased() || !('messages' in channel)) { return { content: [{ type: "text", text: `Cannot find text channel with ID: ${channelId}` }], isError: true }; } const message = await channel.messages.fetch(messageId); if (!message) { return { content: [{ type: "text", text: `Cannot find message with ID: ${messageId}` }], isError: true }; } // Get the reactions const reactions = message.reactions.cache; // Find the specific reaction const reaction = reactions.find(r => r.emoji.toString() === emoji || r.emoji.name === emoji); if (!reaction) { return { content: [{ type: "text", text: `Reaction ${emoji} not found on message ID: ${messageId}` }], isError: true }; } if (userId) { // Remove a specific user's reaction await reaction.users.remove(userId); return { content: [{ type: "text", text: `Successfully removed reaction ${emoji} from user ID: ${userId} on message ID: ${messageId}` }] }; } else { // Remove bot's reaction await reaction.users.remove(client.user.id); return { content: [{ type: "text", text: `Successfully removed bot's reaction ${emoji} from message ID: ${messageId}` }] }; } } catch (error) { return { content: [{ type: "text", text: `Failed to remove reaction: ${error}` }], isError: true }; } }
- src/index.ts:103-108 (schema)Zod schema defining input validation for the tool: channelId, messageId, emoji required; userId optional.const RemoveReactionSchema = z.object({ channelId: z.string(), messageId: z.string(), emoji: z.string(), userId: z.string().optional() });
- src/index.ts:360-372 (registration)Tool registration in MCP ListTools handler, including name, description, and JSON input schema.{ name: "discord_remove_reaction", description: "Removes a specific emoji reaction from a Discord message", inputSchema: { type: "object", properties: { channelId: { type: "string" }, messageId: { type: "string" }, emoji: { type: "string" }, userId: { type: "string" } }, required: ["channelId", "messageId", "emoji"] }