Send Reaction
send_reactionReact to a WhatsApp message with an emoji. Send an empty string to remove the reaction.
Instructions
React to a WhatsApp message with an emoji via the pinned instance. Send empty string to remove reaction.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | Message key identifying the message to react to | |
| reaction | Yes | Emoji reaction (e.g. '👍'). Send empty string to remove reaction. |
Implementation Reference
- src/tools/send-reaction.ts:1-36 (handler)Main handler function `registerSendReaction` that registers the 'send_reaction' tool. It uses Zod schema for input validation, sends a POST request to `/message/sendReaction/{instanceName}` with the message key and reaction emoji, and returns the API response.
import { z } from "zod"; import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { McpError } from "@modelcontextprotocol/sdk/types.js"; import type { EvolutionClient } from "../evolution-client.js"; const schema = { key: z.object({ remoteJid: z.string().min(1).describe("JID of the chat (e.g. 5511999999999@s.whatsapp.net)"), fromMe: z.boolean().describe("Whether the message was sent by this instance"), id: z.string().min(1).describe("Message ID to react to"), }).describe("Message key identifying the message to react to"), reaction: z.string().describe("Emoji reaction (e.g. '👍'). Send empty string to remove reaction."), }; export function registerSendReaction(server: McpServer, client: EvolutionClient): void { server.registerTool( "send_reaction", { title: "Send Reaction", description: "React to a WhatsApp message with an emoji via the pinned instance. Send empty string to remove reaction.", inputSchema: schema, }, async (args) => { try { const data = await client.post(`/message/sendReaction/${client.instanceName}`, { key: args.key, reaction: args.reaction, }); return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; } catch (e) { if (e instanceof McpError) return { isError: true, content: [{ type: "text" as const, text: e.message }] }; throw e; } } ); } - src/tools/send-reaction.ts:6-13 (schema)Input schema for 'send_reaction' tool: requires a `key` object (remoteJid, fromMe, id) identifying the message to react to, and a `reaction` string containing the emoji (empty string to remove).
const schema = { key: z.object({ remoteJid: z.string().min(1).describe("JID of the chat (e.g. 5511999999999@s.whatsapp.net)"), fromMe: z.boolean().describe("Whether the message was sent by this instance"), id: z.string().min(1).describe("Message ID to react to"), }).describe("Message key identifying the message to react to"), reaction: z.string().describe("Emoji reaction (e.g. '👍'). Send empty string to remove reaction."), }; - src/tools/index.ts:20-20 (registration)Import of `registerSendReaction` from the send-reaction module.
import { registerSendReaction } from "./send-reaction.js"; - src/tools/index.ts:93-93 (registration)Registration call: `registerSendReaction(server, client)` called from `registerAllTools` function.
registerSendReaction(server, client); - src/evolution-client.ts:24-26 (helper)The `post` method on EvolutionClient used by the handler to make the HTTP request.
async post<T = unknown>(path: string, body: unknown): Promise<T> { return this.request<T>("POST", path, body); }