Skip to content

Add file sending support for Discord agents (agent -> Discord) #55

Description

@edspencer

Summary

Slack-connected agents can generate files and send them to the chat channel via the herdctl_send_file MCP tool (added in #47). Discord-connected agents cannot — they lack the equivalent wiring. The infrastructure is already platform-agnostic; Discord just needs to plug into it.

Current State

  • Slack: slack-manager.ts creates a FileSenderContext, wraps it via createFileSenderDef(), and passes it as injectedMcpServers to fleetManager.trigger(). The Slack connector has an uploadFile() method that calls files.uploadV2().
  • Discord: discord-manager.ts does not pass injectedMcpServers to fleetManager.trigger(). The Discord connector has no uploadFile() method.

What Needs to Change

1. Add uploadFile() to the Discord connector

Discord.js supports file uploads via channel.send():

await channel.send({
  content: message,
  files: [{ attachment: fileBuffer, name: filename }]
});

Add an uploadFile(params) method to the Discord connector matching the same shape used by the file sender context.

2. Wire up FileSenderContext in discord-manager.ts

Follow the same pattern as slack-manager.ts:

const fileSenderContext: FileSenderContext = {
  workingDirectory: workingDir,
  uploadFile: async (params) => {
    return connector.uploadFile({
      channelId: event.metadata.channelId,
      fileBuffer: params.fileBuffer,
      filename: params.filename,
      message: params.message,
    });
  },
};
const fileSenderDef = createFileSenderDef(fileSenderContext);
injectedMcpServers = { [fileSenderDef.name]: fileSenderDef };

Then pass injectedMcpServers to fleetManager.trigger().

3. No changes to file-sender-mcp.ts

The file sender MCP tool definition is already platform-agnostic. It accepts a FileSenderContext with a generic uploadFile() callback. No changes needed.

Scope

This is a small change — the architecture and tool definition already exist. It's wiring Discord into the same pattern that Slack uses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions