Skip to content

feat(discord): add discord_server tool with 15 actions - #11641

Open
suryanshsrivastava wants to merge 1 commit into
NousResearch:mainfrom
suryanshsrivastava:feat/discord-server-tool
Open

feat(discord): add discord_server tool with 15 actions#11641
suryanshsrivastava wants to merge 1 commit into
NousResearch:mainfrom
suryanshsrivastava:feat/discord-server-tool

Conversation

@suryanshsrivastava

@suryanshsrivastava suryanshsrivastava commented Apr 17, 2026

Copy link
Copy Markdown

Summary

Restores teknium's discord_server tool (originally from commit 2f323ec4, lost during rebase) and adds a new fetch_message action that accepts Discord message URLs for easy single-message retrieval.

What's included

New file: tools/discord_tool.py — 15 actions covering Discord server introspection and basic moderation:

Action Description
list_guilds List all guilds the bot is in
server_info Detailed guild info (member count, channels, roles, features)
list_channels All channels grouped by category
channel_info Detailed channel info (topic, NSFW, slowmode, thread metadata)
list_roles All roles with colors and permissions
member_info Member details (roles, join date, boosting status)
search_members Search members by query
fetch_messages Fetch message history from a channel (with pagination)
fetch_message NEW — Fetch a single message by ID or Discord URL
list_pins List pinned messages in a channel
pin_message Pin a message
unpin_message Unpin a message
create_thread Create a thread in a channel
add_role Add a role to a member
remove_role Remove a role from a member

Gated on DISCORD_BOT_TOKEN — the tool auto-registers when the env var is set, zero cost for non-Discord platforms.

Added to hermes-discord toolset in toolsets.py.

New: fetch_message

The original tool had fetch_messages for channel history but no way to look up a single message. fetch_message accepts:

  • Direct IDs: channel_id=123, message_id=456
  • Discord URL: message_url=https://discord.com/channels/GUILD/CHANNEL/MESSAGE

This is particularly useful for bot-to-bot communication where one bot posts a message and another needs to read it.

Related PRs & Issues

This PR builds on and complements several existing efforts:

Closes

Tests

48 unit tests in tests/tools/test_discord_tool.py covering all 15 actions, URL parsing, error handling, and toolset inclusion. Registry snapshot test updated.

All tests pass: pytest tests/tools/test_discord_tool.py tests/tools/test_registry.py -v → 79 passed.

Attribution

Original implementation by @teknium1 (commit 2f323ec4, Apr 3, 2026). Restored with the fetch_message addition.

Restores teknium's discord_server tool (originally from 2f323ec, lost
during rebase) and adds a new fetch_message action that accepts Discord
message URLs for easy single-message retrieval.

Actions: list_guilds, server_info, list_channels, channel_info,
list_roles, member_info, search_members, fetch_messages, fetch_message,
list_pins, pin_message, unpin_message, create_thread, add_role,
remove_role.

fetch_message accepts either channel_id+message_id or a full Discord URL
(https://discord.com/channels/GUILD/CHANNEL/MESSAGE).

Closes NousResearch#2105
Partially addresses NousResearch#1559

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for preserving the direct single-message lookup idea. Current main already contains the broader server capability, but the PR needs a narrow salvage into the current architecture.

Problems

  • tools/discord_tool.py:573 restores discord_server, while commit 81987f0350b68ab5cf8a1c6d1129a523fe32dcf4 split that interface into discord and discord_admin. Main's dynamic schema path only rebuilds those two tools (model_tools.py:471-493), so restoring the monolith would bypass the current split/schema flow.
  • The direct URL lookup is still missing on main: the current action map at tools/discord_tool.py:633-655 has fetch_messages but not fetch_message, and its schema at tools/discord_tool.py:823-875 has no message_url property.

Suggested changes

  • Salvage _fetch_message through the current discord core-action path, including the manifest, schema, handler defaults, action allowlist, and ID/URL tests.
  • Keep the current discord / discord_admin split and its intent-aware dynamic schema behavior.

This is an automated hermes-sweeper review.

Comment thread tools/discord_tool.py
_ACTION_NAMES = list(_ACTIONS.keys())

registry.register(
name="discord_server",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current main no longer exposes monolithic discord_server: commit 81987f0350b68ab5cf8a1c6d1129a523fe32dcf4 split it, and model_tools.py:471-493 dynamically rebuilds only discord and discord_admin. Please salvage fetch_message through those existing paths instead of adding this registration.

@teknium1 teknium1 added sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets P3 Low — cosmetic, nice to have platform/discord Discord bot adapter sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Add discord_fetch_message tool

3 participants