Skip to main content
Glama
jar285

MCP-Discord

by jar285

discord_remove_reaction

Remove an emoji reaction from a Discord message by specifying the channel, message ID, and emoji to manage reactions in Discord servers.

Instructions

Removes a specific emoji reaction from a Discord message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channelIdYes
messageIdYes
emojiYes
userIdNo

Implementation Reference

  • Handler function that fetches the channel and message, locates the specific reaction by emoji, and removes it either for a specified userId or the bot's own reaction. Returns success or error messages.
    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 }; } }
  • Zod schema defining input parameters for the discord_remove_reaction tool: channelId, messageId, emoji (required), userId (optional). Used for validation in the handler.
    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 the MCP server's listTools handler, providing name, description, and JSON inputSchema for client-side validation.
    { 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"] }

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