add-emoji-reaction
Add an emoji reaction to a message using emoji name or custom emoji. Specify message ID and emoji details for reaction.
Instructions
Add an emoji reaction to a message.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message_id | Yes | ID of the message to react to | |
| emoji_name | Yes | Emoji name (e.g., 'thumbs_up', 'heart', 'rocket') or custom emoji name | |
| emoji_code | No | Unicode code point for the emoji | |
| reaction_type | No | Type of emoji reaction |
Implementation Reference
- src/server.ts:529-545 (handler)The tool handler for 'add-emoji-reaction'. Registers the tool via server.tool() and contains the async handler that calls zulipClient.addReaction().
server.tool( "add-emoji-reaction", "Add an emoji reaction to a message.", AddReactionSchema.shape, async ({ message_id, emoji_name, emoji_code, reaction_type }) => { try { await zulipClient.addReaction(message_id, { emoji_name, emoji_code, reaction_type }); return createSuccessResponse(`Reaction ${emoji_name} added to message ${message_id}!`); } catch (error) { return createErrorResponse(`Error adding reaction: ${error instanceof Error ? error.message : 'Unknown error'}`); } } ); - src/types.ts:140-145 (schema)Zod schema defining the input parameters for add-emoji-reaction: message_id, emoji_name, emoji_code (optional), and reaction_type (optional enum).
export const AddReactionSchema = z.object({ message_id: z.number().describe("ID of the message to react to"), emoji_name: z.string().describe("Emoji name (e.g., 'thumbs_up', 'heart', 'rocket') or custom emoji name"), emoji_code: z.string().optional().describe("Unicode code point for the emoji"), reaction_type: z.enum(["unicode_emoji", "realm_emoji", "zulip_extra_emoji"]).optional().describe("Type of emoji reaction") }); - src/zulip/client.ts:199-212 (helper)The ZulipClient.addReaction() helper method that sends a POST request to /messages/{messageId}/reactions with the emoji payload.
async addReaction(messageId: number, params: { emoji_name: string; emoji_code?: string; reaction_type?: string; }): Promise<void> { const payload: any = { emoji_name: params.emoji_name, reaction_type: params.reaction_type || 'unicode_emoji' }; if (params.emoji_code !== undefined) { payload.emoji_code = params.emoji_code; } await this.client.post(`/messages/${messageId}/reactions`, payload); } - src/server.ts:19-19 (registration)Import of AddReactionSchema from types.ts, needed for registration of the tool.
AddReactionSchema, - src/types.ts:255-255 (registration)Type inference for AddReactionParams from the schema.
export type AddReactionParams = z.infer<typeof AddReactionSchema>;