openclaw - ✅(Solved) Fix [Bug]: Discord message tool never advertises upload-file/sendAttachment — agents cannot discover file-send capability [4 pull requests, 2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#60652Fetched 2026-04-08 02:48:43
View on GitHub
Comments
2
Participants
2
Timeline
17
Reactions
0
Author
Timeline (top)
referenced ×7cross-referenced ×5commented ×2labeled ×2

Discord's describeDiscordMessageTool never adds upload-file or sendAttachment to the action set it returns, so the agent's message tool action enum never includes a file-send action — even though the core tool schema exposes media/path/filePath parameters and the Discord handleAction("send") handler reads them. Confirmed by source inspection of extensions/discord/src/channel-actions.ts and comparison with Slack's working upload-file advertisement in extensions/slack/src/message-actions.ts.

Root Cause

Discord's describeDiscordMessageTool never adds upload-file or sendAttachment to the action set it returns, so the agent's message tool action enum never includes a file-send action — even though the core tool schema exposes media/path/filePath parameters and the Discord handleAction("send") handler reads them. Confirmed by source inspection of extensions/discord/src/channel-actions.ts and comparison with Slack's working upload-file advertisement in extensions/slack/src/message-actions.ts.

Fix Action

Fix / Workaround

Workaround: An agent can use action: "send" with filePath: "/path/to/file" and Discord's handler will process it as mediaUrl. However, the agent has no signal that this is supported since upload-file is not in the action enum.

PR fix notes

PR #60666: fix(discord): advertise upload-file action in message tool

Description (problem / solution / changelog)

Summary

  • The Discord channel's describeDiscordMessageTool never added upload-file to its advertised actions, so agents could not discover or use explicit file-first uploads on Discord — unlike Slack, BlueBubbles, Google Chat, and MS Teams which all expose it.
  • Add upload-file to the messages action gate in discovery, and add a corresponding upload-file handler that routes through the existing sendMessage runtime (which already supports media uploads via mediaUrl/filename).

Closes #60652

Root cause

  • File: extensions/discord/src/channel-actions.ts, lines 88-92
  • Introducing commit: 3a3fdf1 (Peter Steinberger, 2026-04-04) — the messages gate added read, edit, delete but omitted upload-file and download-file
  • Core registry (src/channels/plugins/message-action-names.ts:57-58) already defines both download-file and upload-file as valid action names

What changed

FileChange
extensions/discord/src/channel-actions.tsAdd actions.add("upload-file") under the messages gate
extensions/discord/src/actions/handle-action.tsAdd upload-file handler that validates filePath/path/media, then routes through sendMessage

Call path verification

describeDiscordMessageTool (channel-actions.ts:65)
  → discovery.isEnabled("messages") (line 88)
    → actions.add("upload-file") (NEW, line 92)

handleDiscordMessageAction (handle-action.ts:19)
  → action === "upload-file" (NEW, line 93)
    → handleDiscordAction({ action: "sendMessage", ... }) (line 107)
      → handleDiscordMessagingAction (runtime.ts:68)
        → case "sendMessage" (runtime.messaging.ts:295)
          → sendMessageDiscord (with mediaUrl + filename)

G8: Codebase-wide pattern check

Channels that already advertise upload-file: Slack, BlueBubbles, Google Chat, MS Teams. Channels that do NOT advertise upload-file: Telegram, Mattermost, Matrix, WhatsApp, Signal, IRC, Line, etc.

download-file is NOT added here because Discord lacks a dedicated file-download API endpoint (Slack has files.info). Discord attachments are served via CDN URLs returned in message objects — the existing read action already surfaces those URLs.

Test plan

  • Existing channel-actions.test.ts uses expect.arrayContaining — adding upload-file does not break existing assertions
  • Contract test (registry-actions.ts) has messages: false for Discord — unaffected
  • Manual: configure a Discord bot token, verify upload-file appears in discovered actions
  • Manual: send action: "upload-file" with to, media, and optional filename — verify file is uploaded

🤖 Generated with Claude Code

Changed files

  • extensions/discord/src/actions/handle-action.test.ts (modified, +65/-0)
  • extensions/discord/src/actions/handle-action.ts (modified, +29/-0)
  • extensions/discord/src/channel-actions.test.ts (modified, +44/-4)
  • extensions/discord/src/channel-actions.ts (modified, +1/-0)

PR #60808: fix(discord): advertise upload-file action in describeDiscordMessageTool

Description (problem / solution / changelog)

Problem

Discord's describeDiscordMessageTool never added upload-file to its action set, making file-send capability completely undiscoverable to agents.

Confirmed via source inspection of extensions/discord/src/channel-actions.ts: the action set starts with ["send"] and conditionally adds many actions, but never adds upload-file.

Meanwhile:

  • The backend handler (handle-action.ts:56-60) already reads media/path/filePath on the send action — backend capability exists
  • Slack's implementation (extensions/slack/src/message-actions.ts:37) explicitly adds upload-file
  • The core action name registry (src/channels/plugins/message-action-names.ts:58) defines upload-file as a valid action

This means agents could create files locally but had no signal that Discord file delivery was supported.

Fix

Add actions.add("upload-file") unconditionally in describeDiscordMessageTool. Discord always supports file attachments in both DM and guild channels — no discovery gate needed.

Testing

Updated channel-actions.test.ts to assert upload-file is included in the described action set.

Closes #60652

Changed files

  • extensions/discord/src/actions/handle-action.ts (modified, +33/-0)
  • extensions/discord/src/actions/runtime.messaging.ts (modified, +4/-4)
  • extensions/discord/src/channel-actions.test.ts (modified, +9/-1)
  • extensions/discord/src/channel-actions.ts (modified, +3/-0)

PR #61087: fix(discord): advertise upload-file action so agents can discover file-send capability

Description (problem / solution / changelog)

Closes #60652

Summary

  • Discord message tool now advertises upload-file in its action set, consistent with Slack.
  • Added a dedicated upload-file handler in Discord action dispatch that extracts filePath/path/media parameters and delegates to the existing sendMessage backend.

Root Cause

describeDiscordMessageTool in extensions/discord/src/channel-actions.ts built the action set with send, read, edit, delete, etc. but never included upload-file. The backend capability already existed (the send handler reads media/path/filePath params), but agents could not discover it because the action was not advertised in the tool schema.

Slack correctly adds both download-file and upload-file under its messages feature toggle.

Changes

extensions/discord/src/channel-actions.ts - added upload-file to the action set under the messages feature toggle.

extensions/discord/src/actions/handle-action.ts - added a dedicated upload-file handler that extracts file params (filePath, path, media) and delegates to sendMessage with the media URL, matching Slack pattern.

Test Plan

  • npx vitest run extensions/discord/src/channel-actions.test.ts - 5/5 pass
  • npx vitest run extensions/discord/src/actions/ - 68/68 pass
  • npx vitest run src/agents/tools/message-tool.test.ts - 27/27 pass
  • No lint errors on touched files

Risks and Mitigations

  • download-file was intentionally not added. Discord file API is different from Slack and would need a dedicated handler with attachment ID resolution. A follow-up PR can add this if needed.
  • The upload-file handler delegates to the same sendMessage backend that already handles file attachments via the send action, so no new Discord API surface is involved.

Joel Nishanth - offlyn.AI

Changed files

  • extensions/discord/src/actions/handle-action.ts (modified, +25/-0)
  • extensions/discord/src/channel-actions.ts (modified, +1/-0)

PR #61100: feat(discord): add upload-file action support [claude-generated]

Description (problem / solution / changelog)

Summary

  • Adds the upload-file action to Discord's message tool discovery, so agents can see and use it
  • Adds the corresponding handler in the action dispatch and messaging runtime layers
  • Reuses the existing sendMessageDiscord with mediaUrl for the actual file upload (same mechanism the send action uses for media attachments)
  • Adds a contract test case verifying upload-file appears when messages is enabled

Follows the same pattern as the Slack plugin's existing upload-file implementation.

Fixes #60652

Changes

FileWhat
extensions/discord/src/channel-actions.tsAdd upload-file to the actions set when messages is enabled
extensions/discord/src/actions/handle-action.tsAdd upload-file case to parse params and delegate to uploadFile runtime action
extensions/discord/src/actions/runtime.tsRegister uploadFile in the messagingActions set
extensions/discord/src/actions/runtime.messaging.tsAdd uploadFile case with file validation, media-url assertion, and send
src/channels/plugins/contracts/registry-actions.tsAdd contract test case for Discord with messages: true expecting upload-file

Test plan

  • pnpm build passes
  • pnpm check passes (tsgo, lint, all policy checks)
  • vitest run extensions/discord/src/actions/handle-action.test.ts passes
  • vitest run extensions/discord/src/channel-actions.test.ts passes
  • vitest run src/channels/plugins/contracts/ passes (381 tests including new case)

🤖 Generated with Claude Code

Changed files

  • extensions/discord/src/actions/handle-action.ts (modified, +28/-0)
  • extensions/discord/src/actions/runtime.messaging.ts (modified, +25/-0)
  • extensions/discord/src/actions/runtime.ts (modified, +1/-0)
  • extensions/discord/src/channel-actions.ts (modified, +1/-0)
  • src/channels/plugins/contracts/registry-actions.ts (modified, +33/-0)

Code Example

## Logs, screenshots, and evidence

**Discord `describeDiscordMessageTool` — no file action added** (`extensions/discord/src/channel-actions.ts:71`):

const actions = new Set<ChannelMessageActionName>(["send"]);
if (discovery.isEnabled("polls"))       { actions.add("poll"); }
if (discovery.isEnabled("reactions"))    { actions.add("react"); actions.add("reactions"); actions.add("emoji-list"); }
if (discovery.isEnabled("messages"))     { actions.add("read"); actions.add("edit"); actions.add("delete"); }
// ... pins, threads, search, stickers, members, roles, channels, voice, events, moderation, presence
// NO upload-file or sendAttachment anywhere


**Slack does add it** (`extensions/slack/src/message-actions.ts:41`):

actions.add("upload-file");


**Discord handler accepts file params** (`extensions/discord/src/actions/handle-action.ts:60–64`):

// Support media, path, and filePath for media URL
const mediaUrl =
  readStringParam(params, "media", { trim: false }) ??
  readStringParam(params, "path", { trim: false }) ??
  readStringParam(params, "filePath", { trim: false });


**Core schema always includes file params** (`src/agents/tools/message-tool.ts:96–111`):

media: Type.Optional(Type.String({ description: "Media URL or local path..." })),
path: Type.Optional(Type.String()),
filePath: Type.Optional(Type.String()),
buffer: Type.Optional(Type.String({ description: "Base64 payload for attachments..." })),


**Contract test confirms Discord lacks file actions** (`src/channels/plugins/contracts/registry-actions.ts:206`):

expectedActions: ["send", "poll", "react", "reactions", "emoji-list"],
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

Discord's describeDiscordMessageTool never adds upload-file or sendAttachment to the action set it returns, so the agent's message tool action enum never includes a file-send action — even though the core tool schema exposes media/path/filePath parameters and the Discord handleAction("send") handler reads them. Confirmed by source inspection of extensions/discord/src/channel-actions.ts and comparison with Slack's working upload-file advertisement in extensions/slack/src/message-actions.ts.

Steps to reproduce

Steps to reproduce

  1. Configure OpenClaw with a Discord channel (bot token set, DM or guild channel).
  2. Start a Discord DM session with the bot.
  3. Ask the agent to create a .md file and send it as an attachment.
  4. Observe the tool schema exposed to the agent: the action enum includes send, poll, react, etc. but never upload-file or sendAttachment.
  5. The agent either attempts an unsupported action name, tries send without knowing file params are accepted, or reports it cannot send files.

Alternatively, confirm via code:

  1. Read extensions/discord/src/channel-actions.ts:57–157 (describeDiscordMessageTool).
  2. Search for any code path that adds "upload-file" or "sendAttachment" to the actions set — none exists.
  3. Compare with extensions/slack/src/message-actions.ts:41 which explicitly adds "upload-file".

Expected behavior

The Discord message tool should advertise upload-file in its action set, consistent with Slack's implementation (extensions/slack/src/message-actions.ts:41) and the core action name registry (src/channels/plugins/message-action-names.ts:58) which defines upload-file as a valid action. The Slack registry-actions contract test (src/channels/plugins/contracts/registry-actions.ts:37–51) confirms upload-file is expected for channels that support file sending.

Actual behavior

Discord's describeDiscordMessageTool (extensions/discord/src/channel-actions.ts:71–149) builds the action set starting with ["send"] and conditionally adds poll, react, read, edit, delete, pin, thread, search, sticker, member-info, role, channel-management, voice-status, event, moderation, and presence actions — but never adds upload-file or sendAttachment. The Discord contract test (src/channels/plugins/contracts/registry-actions.ts:206) confirms only ["send", "poll", "react", "reactions", "emoji-list"] are expected.

The agent sees media, path, and filePath in the tool schema (from src/agents/tools/message-tool.ts:96–111) but has no action enum value to indicate file sending is supported. Discord's own handleAction (extensions/discord/src/actions/handle-action.ts:60–64) does read media/path/filePath for the send action, so the backend capability exists but is not discoverable.

OpenClaw version

2026.4.3 (source / main branch)

Operating system

Linux (also reproducible by source inspection on any OS)

Install method

pnpm dev (source checkout)

Model

Any — issue is in tool schema assembly, not model-specific

Provider / routing chain

Any — issue is in tool schema assembly, not provider-specific

Additional provider/model setup details

N/A — this is a tool-schema-level bug independent of provider or model configuration.

Logs, screenshots, and evidence

## Logs, screenshots, and evidence

**Discord `describeDiscordMessageTool` — no file action added** (`extensions/discord/src/channel-actions.ts:71`):

const actions = new Set<ChannelMessageActionName>(["send"]);
if (discovery.isEnabled("polls"))       { actions.add("poll"); }
if (discovery.isEnabled("reactions"))    { actions.add("react"); actions.add("reactions"); actions.add("emoji-list"); }
if (discovery.isEnabled("messages"))     { actions.add("read"); actions.add("edit"); actions.add("delete"); }
// ... pins, threads, search, stickers, members, roles, channels, voice, events, moderation, presence
// NO upload-file or sendAttachment anywhere


**Slack does add it** (`extensions/slack/src/message-actions.ts:41`):

actions.add("upload-file");


**Discord handler accepts file params** (`extensions/discord/src/actions/handle-action.ts:60–64`):

// Support media, path, and filePath for media URL
const mediaUrl =
  readStringParam(params, "media", { trim: false }) ??
  readStringParam(params, "path", { trim: false }) ??
  readStringParam(params, "filePath", { trim: false });


**Core schema always includes file params** (`src/agents/tools/message-tool.ts:96–111`):

media: Type.Optional(Type.String({ description: "Media URL or local path..." })),
path: Type.Optional(Type.String()),
filePath: Type.Optional(Type.String()),
buffer: Type.Optional(Type.String({ description: "Base64 payload for attachments..." })),


**Contract test confirms Discord lacks file actions** (`src/channels/plugins/contracts/registry-actions.ts:206`):

expectedActions: ["send", "poll", "react", "reactions", "emoji-list"],

Impact and severity

  • Affected: All Discord channels (DM and guild) — agents cannot discover file-send capability
  • Severity: Medium (blocks file attachment delivery workflow; text replies unaffected)
  • Frequency: Always — no config combination causes upload-file to appear for Discord
  • Consequence: Agents can create files locally but cannot deliver them as Discord attachments; users must work around by manually downloading and re-uploading

Additional information

Workaround: An agent can use action: "send" with filePath: "/path/to/file" and Discord's handler will process it as mediaUrl. However, the agent has no signal that this is supported since upload-file is not in the action enum.

Likely fix: Add actions.add("upload-file") (and optionally "download-file") in describeDiscordMessageTool, either ungated (Discord always supports file attachments) or behind a new config gate like discovery.isEnabled("files"). The Discord contract test expectations would also need updating.

extent analysis

TL;DR

The most likely fix is to add "upload-file" to the action set in describeDiscordMessageTool to enable file attachment delivery workflow for Discord channels.

Guidance

  • Review the describeDiscordMessageTool function in extensions/discord/src/channel-actions.ts to understand how the action set is currently built.
  • Add actions.add("upload-file") to the action set, either unconditionally or behind a new config gate like discovery.isEnabled("files").
  • Update the Discord contract test expectations in src/channels/plugins/contracts/registry-actions.ts to include "upload-file" as a valid action.
  • Verify that the agent can now discover the file-send capability and deliver files as Discord attachments.

Example

// In extensions/discord/src/channel-actions.ts
const actions = new Set<ChannelMessageActionName>(["send"]);
// ... existing conditional additions
actions.add("upload-file"); // Add this line to include file attachment support

Notes

  • The fix assumes that Discord always supports file attachments, but a config gate can be added if needed.
  • The agent can currently use action: "send" with filePath: "/path/to/file" as a workaround, but this is not discoverable without the "upload-file" action.

Recommendation

Apply the workaround by adding actions.add("upload-file") to describeDiscordMessageTool, as this enables the file attachment delivery workflow for Discord channels without requiring a full version upgrade.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

The Discord message tool should advertise upload-file in its action set, consistent with Slack's implementation (extensions/slack/src/message-actions.ts:41) and the core action name registry (src/channels/plugins/message-action-names.ts:58) which defines upload-file as a valid action. The Slack registry-actions contract test (src/channels/plugins/contracts/registry-actions.ts:37–51) confirms upload-file is expected for channels that support file sending.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING