Skip to main content
Glama

remove_reactions

Remove reactions from Discord messages by specifying server, channel, and message IDs. Optionally target specific emojis or users to clean up message interactions.

Instructions

Remove reactions from a message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)
channelIdYesThe ID of the channel
messageIdYesThe ID of the message
emojiNoSpecific emoji to remove (removes all if not specified)
userIdNoRemove reaction from specific user

Implementation Reference

  • Handler function that fetches the Discord message and removes reactions: all reactions if no emoji, specific emoji from all users, or specific user's reaction on emoji using Discord.js reactions API. Wraps in error handling and returns formatted response.
    async ({ guildId, channelId, messageId, emoji, userId }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const guild = await client.guilds.fetch(guildId); const channel = await guild.channels.fetch(channelId); if (!isMessageableChannel(channel)) { throw new Error('Channel does not support messages'); } const message = await channel.messages.fetch(messageId); if (!emoji) { await message.reactions.removeAll(); return { messageId, message: 'All reactions removed' }; } else if (userId) { const reaction = message.reactions.cache.get(emoji); if (reaction) await reaction.users.remove(userId); return { messageId, emoji, userId, message: 'User reaction removed' }; } else { const reaction = message.reactions.cache.get(emoji); if (reaction) await reaction.remove(); return { messageId, emoji, message: 'Reaction removed' }; } }); if (!result.success) { return { content: [{ type: 'text', text: result.error }], isError: true }; } return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] }; }
  • Zod input schema validating guildId, channelId, messageId (required), and optional emoji and userId parameters.
    { guildId: z.string().describe('The ID of the server (guild)'), channelId: z.string().describe('The ID of the channel'), messageId: z.string().describe('The ID of the message'), emoji: z.string().optional().describe('Specific emoji to remove (removes all if not specified)'), userId: z.string().optional().describe('Remove reaction from specific user'), },
  • MCP server.tool registration for 'remove_reactions' tool, specifying name, description, input schema, and handler function.
    // Remove reactions server.tool( 'remove_reactions', 'Remove reactions from a message', { guildId: z.string().describe('The ID of the server (guild)'), channelId: z.string().describe('The ID of the channel'), messageId: z.string().describe('The ID of the message'), emoji: z.string().optional().describe('Specific emoji to remove (removes all if not specified)'), userId: z.string().optional().describe('Remove reaction from specific user'), }, async ({ guildId, channelId, messageId, emoji, userId }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const guild = await client.guilds.fetch(guildId); const channel = await guild.channels.fetch(channelId); if (!isMessageableChannel(channel)) { throw new Error('Channel does not support messages'); } const message = await channel.messages.fetch(messageId); if (!emoji) { await message.reactions.removeAll(); return { messageId, message: 'All reactions removed' }; } else if (userId) { const reaction = message.reactions.cache.get(emoji); if (reaction) await reaction.users.remove(userId); return { messageId, emoji, userId, message: 'User reaction removed' }; } else { const reaction = message.reactions.cache.get(emoji); if (reaction) await reaction.remove(); return { messageId, emoji, message: 'Reaction removed' }; } }); if (!result.success) { return { content: [{ type: 'text', text: result.error }], isError: true }; } return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] }; } );

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/scarecr0w12/discord-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server