Skip to main content
Glama

discord_read_messages

Retrieve recent messages from a Discord text channel to monitor conversations or extract information.

Instructions

Read the last N messages from a text channel.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channel_idYes
limitNo1–100, default 20.

Implementation Reference

  • The handler logic for 'discord_read_messages' which fetches the last N messages from a discord channel.
    case "discord_read_messages": {
      const channel = await getTextChannel(args.channel_id as string);
      const limit = Math.min(Number(args.limit ?? 20), 100);
      const messages = await channel.messages.fetch({ limit });
      const result = [...messages.values()]
        .sort((a, b) => a.createdTimestamp - b.createdTimestamp)
        .map((m) => ({
          id: m.id, author: m.author.tag, content: m.content,
          timestamp: m.createdAt.toISOString(), attachments: m.attachments.size, pinned: m.pinned,
        }));
      return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
    }
  • The schema registration for 'discord_read_messages' defining input parameters.
    {
      name: "discord_read_messages",
      description: "Read the last N messages from a text channel.",
      inputSchema: {
        type: "object",
        properties: {
          channel_id: { type: "string" },
          limit: { type: "number", description: "1–100, default 20." },
        },
        required: ["channel_id"],
      },
    },

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

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