slack_add_reaction
Add an emoji reaction to a specific message in Slack by providing the channel ID, emoji name, and message timestamp.
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 in the format '1234567890.123456' |
Implementation Reference
- src/index.ts:237-250 (handler)The main handler function for the 'slack_add_reaction' tool. Parses input using AddReactionRequestSchema, calls slackClient.reactions.add with channel_id, timestamp, and reaction, and returns success message.case 'slack_add_reaction': { const args = AddReactionRequestSchema.parse(request.params.arguments); const response = await slackClient.reactions.add({ channel: args.channel_id, timestamp: args.timestamp, name: args.reaction, }); if (!response.ok) { throw new Error(`Failed to add reaction: ${response.error}`); } return { content: [{ type: 'text', text: 'Reaction added successfully' }], }; }
- src/schemas.ts:101-114 (schema)Zod input schema definition for the slack_add_reaction tool, validating channel_id, reaction emoji name, and message timestamp.export const AddReactionRequestSchema = z.object({ channel_id: z .string() .describe('The ID of the channel containing the message'), reaction: z.string().describe('The name of the emoji reaction (without ::)'), timestamp: z .string() .regex(/^\d{10}\.\d{6}$/, { message: "Timestamp must be in the format '1234567890.123456'", }) .describe( "The timestamp of the message to react to in the format '1234567890.123456'" ), });
- src/index.ts:131-135 (registration)Tool registration in the listTools handler, defining name, description, and inputSchema for slack_add_reaction.{ name: 'slack_add_reaction', description: 'Add a reaction emoji to a message', inputSchema: zodToJsonSchema(AddReactionRequestSchema), },