discord_add_reaction
Add emoji reactions to Discord messages by specifying channel ID, message ID, and emoji. This tool enables users to interact with Discord content through reactions.
Instructions
Add a reaction to a message
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channelId | Yes | The Discord channel ID | |
| messageId | Yes | The message ID to react to | |
| emoji | Yes | Emoji to react with (Unicode or custom emoji format) |
Implementation Reference
- src/tools/reaction_tools.ts:6-19 (handler)Factory function returning the ToolHandler object for 'discord_add_reaction'. Includes input schema validation with Zod, policy check, calls DiscordClient.addReaction, and returns success response. This is the primary implementation of the tool logic.export function addReactionTool(dc: DiscordClient, policy: Policy): ToolHandler { const input = z.object({ channel_id: z.string(), message_id: z.string(), emoji: z.string() }); return { name: 'discord_add_reaction', description: 'Add a reaction emoji to a message.', inputSchema: input, async *handler({ input }: { input: any }){ const { channel_id, message_id, emoji } = input as any; if (!policy.allowChannel(channel_id)) throw new Error('Channel not allowed by policy'); await dc.addReaction(channel_id, message_id, emoji); yield { content: [{ type: 'text', text: 'ok' }] }; } }; }
- src/discord.ts:87-89 (helper)DiscordClient helper method that performs the actual Discord REST API call to add a reaction to a message using the bot's own reaction endpoint.async addReaction(channelId: string, messageId: string, emoji: string): Promise<void> { await this.rest.put(Routes.channelMessageOwnReaction(channelId, messageId, emoji)); }
- src/index.ts:153-153 (registration)Commented registration of the addReactionTool in the main server setup. Indicates that a generated version is used instead.// registerTool(addReactionTool(dc, policy)); // Using generated version instead