DiscordTools enable an agent to send messages, read message history, manage channels, and delete messages in Discord.

Prerequisites

The following example requires a Discord bot token which can be obtained from here.

export DISCORD_BOT_TOKEN=***

Example

cookbook/agent_concepts/tools/discord.py
from agno.agent import Agent
from agno.tools.discord import DiscordTools

agent = Agent(
    tools=[DiscordTools()],
    show_tool_calls=True,
    markdown=True,
)

agent.print_response("Send 'Hello World!' to channel 1234567890", markdown=True)

Toolkit Params

ParameterTypeDefaultDescription
bot_tokenstr-Discord bot token for authentication.
enable_messagingboolTrueWhether to enable sending messages to channels.
enable_historyboolTrueWhether to enable retrieving message history from channels.
enable_channel_managementboolTrueWhether to enable fetching channel info and listing channels.
enable_message_managementboolTrueWhether to enable deleting messages from channels.

Toolkit Functions

FunctionDescription
send_messageSend a message to a specified channel. Returns a success or error message.
get_channel_infoRetrieve information about a specified channel. Returns the channel info as a JSON string.
list_channelsList all channels in a specified server (guild). Returns the list of channels as JSON.
get_channel_messagesRetrieve message history from a specified channel. Returns messages as a JSON string.
delete_messageDelete a specific message by ID from a specified channel. Returns a success or error message.

Developer Resources