discord_add_reaction
React to a Discord message using an emoji by specifying the channel, message ID, and emoji. Part of MCP-Discord's toolkit for AI-driven Discord interactions.
Instructions
Adds an emoji reaction to a specific Discord message
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channelId | Yes | ||
| emoji | Yes | ||
| messageId | Yes |
Implementation Reference
- src/index.ts:985-1026 (handler)The handler function for the 'discord_add_reaction' tool. It validates input using AddReactionSchema, checks client readiness, fetches the channel and message, adds the reaction with message.react(emoji), and returns success or error.case "discord_add_reaction": { const { channelId, messageId, emoji } = AddReactionSchema.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 }; } // Add the reaction await message.react(emoji); return { content: [{ type: "text", text: `Successfully added reaction ${emoji} to message ID: ${messageId}` }] }; } catch (error) { return { content: [{ type: "text", text: `Failed to add reaction: ${error}` }], isError: true }; } }
- src/index.ts:91-95 (schema)Zod schema defining the input parameters for the discord_add_reaction tool: channelId, messageId, and emoji.const AddReactionSchema = z.object({ channelId: z.string(), messageId: z.string(), emoji: z.string() });
- src/index.ts:331-343 (registration)Registration of the 'discord_add_reaction' tool in the ListTools response, specifying name, description, and input schema.{ name: "discord_add_reaction", description: "Adds an emoji reaction to a specific Discord message", inputSchema: { type: "object", properties: { channelId: { type: "string" }, messageId: { type: "string" }, emoji: { type: "string" } }, required: ["channelId", "messageId", "emoji"] } },