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
| Name | Required | Description | Default |
|---|---|---|---|
| channelId | Yes | The Discord channel ID | |
| limit | No | Number of messages to retrieve (1-100, default: 50) | |
| before | No | Get messages before this message ID | |
| after | No | Get messages after this message ID | |
| around | No | Get messages around this message ID |
Implementation Reference
- src/core/DiscordController.ts:69-80 (registration)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`); }
- src/core/AutomationManager.ts:526-529 (handler)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); }
- src/types.ts:328-333 (schema)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") });