Skip to main content
Glama
drvova

Discord MCP Server

discord_get_message_history

Retrieve message history from Discord channels with filtering options to analyze conversations, track discussions, or review past interactions.

Instructions

Get message history from a Discord channel with optional filtering

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channelIdYesThe Discord channel ID
limitNoNumber of messages to retrieve (1-100, default: 50)
beforeNoGet messages before this message ID
afterNoGet messages after this message ID
aroundNoGet messages around this message ID

Implementation Reference

  • Dynamic dispatching for tool execution: converts snake_case tool names like 'get_message_history' to camelCase 'getMessageHistory' and calls the corresponding method on AutomationManager.
    private async callAutomationMethod(action: string, params: any): Promise<string> {
      // Convert action name to method name (snake_case to camelCase)
      const methodName = action.replace(/_([a-z])/g, (g) => g[1].toUpperCase());
      
      // Check if method exists
      if (typeof (this.automationManager as any)[methodName] === 'function') {
        // Call the method with params
        return await (this.automationManager as any)[methodName](...Object.values(params));
      }
      
      throw new Error(`Method '${methodName}' not found in AutomationManager`);
    }
  • Core handler function for 'discord_get_message_history' tool: validates input parameters and fetches message history from Discord channel using DiscordService.
    async getMessageHistory(channelId?: string, limit?: number, before?: string, after?: string): Promise<string> {
      const parsed = schemas.GetMessageHistorySchema.parse({ channelId, limit, before, after });
      return await this.discordService.getMessageHistory(parsed.channelId, parsed.limit, parsed.before, parsed.after);
    }
  • Input schema (Zod) for the tool, validating channelId (required string) and optional limit, before, after parameters.
    export const GetMessageHistorySchema = z.object({
      channelId: z.string().describe("Channel ID"),
      limit: z.number().optional().describe("Number of messages to fetch"),
      before: z.string().optional().describe("Message ID to fetch before"),
      after: z.string().optional().describe("Message ID to fetch after")
    });

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

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