slack_add_reaction
Add an emoji reaction to a specific message in a Slack channel using channel ID, message timestamp, and reaction name.
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 | |
| timestamp | Yes | The timestamp of the message to react to | |
| reaction | Yes | The name of the emoji reaction (without ::) |
Implementation Reference
- index.ts:441-456 (handler)MCP tool handler for 'slack_add_reaction': validates arguments and calls SlackClient.addReaction method.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:278-294 (helper)SlackClient method that performs the HTTP POST to Slack's reactions.add API 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.headers, body: JSON.stringify({ channel: channel_id, timestamp: timestamp, name: reaction, }), }); return response.json(); }
- index.ts:116-137 (schema)Tool schema definition including name, description, and input schema for 'slack_add_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:28-32 (schema)TypeScript interface defining the arguments for slack_add_reaction tool.interface AddReactionArgs { channel_id: string; timestamp: string; reaction: string; }
- index.ts:532-546 (registration)Registers the slack_add_reaction tool (as addReactionTool) in the list of available tools returned by ListToolsRequest.server.setRequestHandler(ListToolsRequestSchema, async () => { console.error("Received ListToolsRequest"); return { tools: [ listChannelsTool, postMessageTool, replyToThreadTool, addReactionTool, getChannelHistoryTool, getThreadRepliesTool, getUsersTool, getUserProfileTool, ], }; });