Skip to main content
Glama

discord_get_message_history

Retrieve message history from a Discord channel with filters like limit, before, after, or around specific message IDs for precise data access and management.

Instructions

Get message history from a Discord channel with optional filtering

Input Schema

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

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "after": { "description": "Get messages after this message ID", "type": "string" }, "around": { "description": "Get messages around this message ID", "type": "string" }, "before": { "description": "Get messages before this message ID", "type": "string" }, "channelId": { "description": "The Discord channel ID", "type": "string" }, "limit": { "description": "Number of messages to retrieve (1-100, default: 50)", "maximum": 100, "minimum": 1, "type": "number" } }, "required": [ "channelId" ], "type": "object" }

Implementation Reference

  • Handler function that implements the core logic for the 'discord_get_message_history' tool. It parses input parameters using the schema and delegates execution to DiscordService.getMessageHistory.
    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); }
  • Zod schema for input validation of the 'discord_get_message_history' tool, defining parameters like channelId, limit, before, and after.
    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") });
  • Dynamic registration and dispatch mechanism that converts snake_case tool names (e.g., 'get_message_history') to camelCase method names and invokes the corresponding handler 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`); }

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