discord_add_reaction
React to a specific message in a Discord channel by providing the channel ID, message ID, and emoji. Simplify interaction and engagement in Discord conversations using this tool.
Instructions
Add a reaction to a message
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channelId | Yes | The Discord channel ID | |
| emoji | Yes | Emoji to react with (Unicode or custom emoji format) | |
| messageId | Yes | The message ID to react to |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"channelId": {
"description": "The Discord channel ID",
"type": "string"
},
"emoji": {
"description": "Emoji to react with (Unicode or custom emoji format)",
"type": "string"
},
"messageId": {
"description": "The message ID to react to",
"type": "string"
}
},
"required": [
"channelId",
"messageId",
"emoji"
],
"type": "object"
}
Implementation Reference
- src/tools/reaction_tools.ts:12-17 (handler)The main handler function for the 'discord_add_reaction' tool. It extracts input parameters, checks channel policy, calls DiscordClient.addReaction, and yields a success response.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/tools/reaction_tools.ts:7-7 (schema)Zod schema defining the input for the tool: channel_id, message_id, and emoji as strings.const input = z.object({ channel_id: z.string(), message_id: z.string(), emoji: z.string() });
- src/tools/reaction_tools.ts:6-19 (registration)The factory function that returns the ToolHandler object for 'discord_add_reaction', including name, description, schema, and handler. This is imported in src/index.ts but registration is commented out in favor of generated version.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)Supporting method in DiscordClient that performs the actual REST API call to add a reaction to a message.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)Location in src/index.ts where the tool would be registered using registerTool, but commented out to use generated version instead.// registerTool(addReactionTool(dc, policy)); // Using generated version instead