Skip to content

Feature: Add discord_fetch_message tool #2105

@diegohb

Description

@diegohb

Feature Description

Add support for fetching Discord messages by ID via a discord_fetch_message tool.

Motivation

Hermes currently cannot access Discord message history. When users paste Discord message links (e.g., https://discord.com/channels/1472019441586933937/1484330055529136158/1484330123011428442), Hermes can parse the link but cannot retrieve the actual message content. This limits conversation continuity and context awareness.

Proposed Solution

Implementation Plan

  1. Expose Discord client to tools layer

    • The Discord gateway adapter already has a Discord bot client
    • Make it accessible to the tool system
  2. Create discord_fetch_message tool

    • File: tools/discord_tool.py
    • Parameters:
      • message_id (str, required): Discord message ID
      • channel_id (str, optional): Channel ID (if inferable from context)
    • Returns: Message content, author, timestamp, attachments
  3. Register the tool

    • Add to tools/registry.py
    • Add to appropriate toolset in toolsets.py
    • Check that bot has "Read Message History" permission
  4. Gateway integration

    • Ensure the Discord client is available to the tool handler
    • May need to pass the client through a singleton or dependency injection

Example Usage

User: https://discord.com/channels/1472019441586933937/1484330055529136158/1484330123011428442
Hermes: [Parses link] Fetching message 1484330123011428442 from channel 1484330055529136158...
Hermes: Found! User @diegohb said: "Here's the config we discussed earlier: [...]"

Technical Notes

  • Discord API: GET /channels/{channel.id}/messages/{message.id}
  • Bot must be in the server and have access to the channel
  • Rate limits: ~50 requests per second per bot (should be fine for Hermes use)
  • Error handling: 404 (message deleted), 403 (no access), etc.

Alternatives Considered

  1. Search session history - Already works for past Hermes conversations, but not for messages Hermes wasn't present for
  2. User manual paste - Works but cumbersome, defeats the purpose of link references
  3. Full Discord history dump - Overkill, privacy concerns

Labels

enhancement, discord, tool, feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions