Skip to main content
Glama
jar285

MCP-Discord

by jar285

discord_add_reaction

Add emoji reactions to Discord messages by specifying channel ID, message ID, and emoji. This tool enables AI assistants to interact with Discord platforms through the MCP-Discord server.

Instructions

Adds an emoji reaction to a specific Discord message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channelIdYes
messageIdYes
emojiYes

Implementation Reference

  • The handler logic for the discord_add_reaction tool. It validates input with AddReactionSchema, checks client readiness, fetches the channel and message, adds the emoji reaction using Discord.js message.react(), and returns success or error response.
    case "discord_add_reaction": {
      const { channelId, messageId, emoji } = AddReactionSchema.parse(args);
      try {
        if (!client.isReady()) {
          return {
            content: [{ type: "text", text: "Discord client not logged in. Please use discord_login tool first." }],
            isError: true
          };
        }
    
        const channel = await client.channels.fetch(channelId);
        if (!channel || !channel.isTextBased() || !('messages' in channel)) {
          return {
            content: [{ type: "text", text: `Cannot find text channel with ID: ${channelId}` }],
            isError: true
          };
        }
    
        const message = await channel.messages.fetch(messageId);
        if (!message) {
          return {
            content: [{ type: "text", text: `Cannot find message with ID: ${messageId}` }],
            isError: true
          };
        }
    
        // Add the reaction
        await message.react(emoji);
    
        return {
          content: [{ 
            type: "text", 
            text: `Successfully added reaction ${emoji} to message ID: ${messageId}` 
          }]
        };
      } catch (error) {
        return {
          content: [{ type: "text", text: `Failed to add reaction: ${error}` }],
          isError: true
        };
      }
    }
  • Zod schema for input validation of discord_add_reaction tool parameters: channelId, messageId, emoji.
    const AddReactionSchema = z.object({
        channelId: z.string(),
        messageId: z.string(),
        emoji: z.string()
    });
  • src/index.ts:331-343 (registration)
    Tool registration in the ListTools response, including name, description, and inputSchema matching the Zod schema.
    {
      name: "discord_add_reaction",
      description: "Adds an emoji reaction to a specific Discord message",
      inputSchema: {
        type: "object",
        properties: {
          channelId: { type: "string" },
          messageId: { type: "string" },
          emoji: { type: "string" }
        },
        required: ["channelId", "messageId", "emoji"]
      }
    },
  • Input schema definition in the tool registration for discord_add_reaction.
    inputSchema: {
      type: "object",
      properties: {
        channelId: { type: "string" },
        messageId: { type: "string" },
        emoji: { type: "string" }
      },
      required: ["channelId", "messageId", "emoji"]
    }

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/jar285/mcp-discord'

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