2.2 KiB
2.2 KiB
Agent sends files to the user
Give the agent a send_file tool, so it can hand back images, videos, PDFs, archives or any other file it made. The bot uploads the file into the session's thread, where Slack previews images, video and PDFs inline.
Shape
- The tool runs inside the container. It's a tiny stdio MCP server added to
nix/container.nix(for exampleslackerbot-tools). The bot passes it to goose insession/newandsession/loadthroughmcpServers(now[]inacp.go), so every session gets it without a goose config change.send_file(path, comment?): checks that the path is a regular file under/rootand below the size cap, then returns"queued". It doesn't move any bytes itself, so file contents never land in the model's context.- Check first that the
goose serveversion we ship honoursmcpServersfrom ACP. If it doesn't, register the extension in goose's config incontainer.nixinstead.
- The bot does the upload. The streamer already sees ACP
tool_call/tool_call_updatemessages. When asend_filecall completes, the bot readsrawInput.path, fetches the file from the container's home, and callsfiles.uploadV2(files:write) into the thread, withcommentas the initial message. - Getting the bytes from the home needs a new node operation,
read_file(machine, path), that streams the file in chunks the same wayexport_home/read_exportdo.localopens the file withos.OpenInRoot(home, rel)(Go 1.24), so symlinks and..can't escape the home.- It's a new call name in
manager/cluster.go. Old slaves answer "unknown call", and the bot replies "This node is too old to send files" instead of failing the turn. - Files go node → master → Slack, so slaves still need no Slack token.
Limits and config
max_send_file_mbinconfig.toml(default 100). Slack's own limit is 1 GB.- At most a few files per turn, so a looping agent can't flood a thread.
- The tool's description tells the agent to use it for anything the user should see or download, rather than pasting long output.
Docs to update when built
USERGUIDE (agent can send files), ARCHITECTURE (read_file call, MCP tool), INSTALLATION and config.example.toml (max_send_file_mb).