slack_add_reaction
Add an emoji reaction to Slack messages using channel ID, message timestamp, and reaction name to express responses or acknowledge content.
Instructions
Add a reaction emoji to a message
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channel_id | Yes | The ID of the channel containing the message | |
| reaction | Yes | The name of the emoji reaction (without ::) | |
| timestamp | Yes | The timestamp of the message to react to |
Implementation Reference
- index.ts:467-482 (handler)Handler for the slack_add_reaction tool within the CallToolRequest switch statement. It validates input arguments and invokes the SlackClient.addReaction method to perform the action.case "slack_add_reaction": { const args = request.params.arguments as unknown as AddReactionArgs; if (!args.channel_id || !args.timestamp || !args.reaction) { throw new Error( "Missing required arguments: channel_id, timestamp, and reaction", ); } const response = await slackClient.addReaction( args.channel_id, args.timestamp, args.reaction, ); return { content: [{ type: "text", text: JSON.stringify(response) }], }; }
- index.ts:116-137 (schema)Input schema and Tool definition for slack_add_reaction, specifying parameters channel_id, timestamp, and reaction.const addReactionTool: Tool = { name: "slack_add_reaction", description: "Add a reaction emoji to a message", inputSchema: { type: "object", properties: { channel_id: { type: "string", description: "The ID of the channel containing the message", }, timestamp: { type: "string", description: "The timestamp of the message to react to", }, reaction: { type: "string", description: "The name of the emoji reaction (without ::)", }, }, required: ["channel_id", "timestamp", "reaction"], }, };
- index.ts:304-320 (helper)Core implementation in SlackClient class that makes the HTTP POST request to Slack's reactions.add API endpoint to add the reaction.async addReaction( channel_id: string, timestamp: string, reaction: string, ): Promise<any> { const response = await fetch("https://slack.com/api/reactions.add", { method: "POST", headers: this.botHeaders, body: JSON.stringify({ channel: channel_id, timestamp: timestamp, name: reaction, }), }); return response.json(); }
- index.ts:570-580 (registration)Registration of the slack_add_reaction tool (referenced as addReactionTool) in the array returned by the ListToolsRequest handler.tools: [ listChannelsTool, postMessageTool, replyToThreadTool, addReactionTool, getChannelHistoryTool, getThreadRepliesTool, getUsersTool, getUserProfileTool, lookupUserByEmailTool, ],
- index.ts:28-32 (schema)TypeScript interface defining the arguments for the slack_add_reaction tool.interface AddReactionArgs { channel_id: string; timestamp: string; reaction: string; }