@tpmjs/tools-discord
Retrieve recent messages from a Discord channel.
Test @tpmjs/tools-discord (listMessages) with AI-powered execution
0/2000 characters
Install this tool and use it with the AI SDK
npm install @tpmjs/tools-discordpnpm add @tpmjs/tools-discordyarn add @tpmjs/tools-discordbun add @tpmjs/tools-discorddeno add npm:@tpmjs/tools-discordimport { listMessages } from '@tpmjs/tools-discord';import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { listMessages } from '@tpmjs/tools-discord';
const result = await generateText({
model: openai('gpt-4o'),
tools: { listMessages },
prompt: 'Your prompt here...',
});
console.log(result.text);(channel_id: string, after?: string, limit?: number, around?: string, before?: string) => Promise<unknown>Available configuration options
channel_idstringThe ID of the channel to get messages from.
limitnumberNumber of messages to retrieve (1-100, default: 50).
beforestringGet messages before this message ID.
afterstringGet messages after this message ID.
aroundstringGet messages around this message ID.
Schema extracted: 2/26/2026, 4:20:27 AM
Discord API tools for AI agents. Send messages, manage guilds, channels, threads, members, reactions, and more.
npm install @tpmjs/tools-discord
Set the DISCORD_BOT_TOKEN environment variable. Get your token from Discord Developer Portal.
Required bot permissions: Send Messages, Read Message History, Manage Messages, Manage Channels, Add Reactions, Manage Threads.
import { sendMessage, listGuilds } from '@tpmjs/tools-discord'; const result = await sendMessage.execute({ channel_id: '123456789', content: 'Hello from AI!' }); const guilds = await listGuilds.execute({});
| Tool | Description |
|---|---|
| sendMessage | Send a message to a channel |
| listGuilds | List guilds the bot is in |
| getGuild | Get guild details |
| listChannels | List guild channels |
| getChannel | Get channel details |
| listMessages | Get recent messages from a channel |
| createChannel | Create a text/voice/category channel |
| editMessage | Edit a previously sent message |
| deleteMessage | Delete a message |
| addReaction | Add emoji reaction to a message |
| listMembers | List guild members |
| getMember | Get member details |
| createThread | Create a thread from a message |
| listThreads | List active threads |
| pinMessage | Pin a message |
MIT
Downloads/month
49
GitHub Stars
8
Executions
2
Quality Score