Skip to main content
Glama

add-emoji-reaction

Add emoji reactions to Zulip messages using emoji names or codes to express responses and engage with content in conversations.

Instructions

Add an emoji reaction to a message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
message_idYesID of the message to react to
emoji_nameYesEmoji name (e.g., 'thumbs_up', 'heart', 'rocket') or custom emoji name
emoji_codeNoUnicode code point for the emoji
reaction_typeNoType of emoji reaction

Implementation Reference

  • The main handler function for the 'add-emoji-reaction' tool. It destructures input parameters, calls the ZulipClient.addReaction method, and returns success or error response in MCP format.
    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/server.ts:529-545 (registration)
    Registers the 'add-emoji-reaction' tool with the MCP server, specifying name, description, input schema, and handler function.
    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'}`);
        }
      }
    );
  • Zod schema defining the input parameters and validation for the add-emoji-reaction tool.
    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")
    });
  • ZulipClient helper method that performs the actual API call to add an emoji reaction to a Zulip message.
    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);
    }

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/avisekrath/zulip-mcp-server'

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