Skip to main content
Glama
lars-hagen

Slack User MCP Server

by lars-hagen

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
NameRequiredDescriptionDefault
channel_idYesThe ID of the channel containing the message
timestampYesThe timestamp of the message to react to
reactionYesThe name of the emoji reaction (without ::)

Implementation Reference

  • 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) }],
      };
    }
  • 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();
    }
  • 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"],
      },
    };
  • 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,
        ],
      };
    });

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/lars-hagen/slack-user-mcp'

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