Skip to content

Add fetch_file tool: download any Slack attachment on demand - #3

Merged
odfalik merged 2 commits into
mainfrom
slack-download-all-attachments
Jul 8, 2026
Merged

odfalik merged 2 commits into
mainfrom
slack-download-all-attachments

Conversation

@odfalik

@odfalik odfalik commented Jul 8, 2026 •

Copy link
Copy Markdown
Collaborator

Agents could only open images — every other attachment (PDF, CSV, HTML, …) was just noted by name with no way to fetch it.

Design: on-demand, not eager. Message renders (read_history, get_thread, inbound thread-context) download nothing now. Each attachment is annotated inline with its type, size, and Slack file id:

[file: postman_eval_summary.html (text/plain, 19KB) · fetch_file id=F0BGSTS7HKJ]

When the agent actually wants a file, it calls the new fetch_file tool with that id → the file is downloaded to a local cache dir and its path returned for the agent's Read tool. Works for images too. Cache-hit reuses; bad/missing ids error gracefully.

Reuses the existing files:read scope — no new Slack permissions.

Verified standalone against a real non-image (text/plain HTML) attachment: annotation triggers no download; fetch_file pulls the full 19,595 bytes; second call hits cache; bad id + missing id both return clean errors. Also verified live after restarting the MCP.

odfalik added 2 commits July 8, 2026 09:52
Non-image files (PDFs, CSVs, HTML, etc.) were only noted by name, so agents
couldn't open them. Now every attachment is cached to a local path (same
on-demand-Read pattern as images) with a size guard to keep routine history
reads from stalling on huge files. Reuses the existing files:read scope.
Message renders (read_history / get_thread / thread-context) no longer download
anything — each attachment is annotated inline with its type, size, and Slack
file id. The new fetch_file tool takes that id, downloads the file (image, PDF,
CSV, whatever) to a local cache dir, and returns the path for the agent's Read
tool. Cache-hit reuses; bad/missing ids error gracefully. Reuses files:read.
@odfalik odfalik changed the title Download all file attachments, not just images Add fetch_file tool: download any Slack attachment on demand Jul 8, 2026
@odfalik
odfalik merged commit f1ff4c0 into main Jul 8, 2026
3 of 4 checks passed
@odfalik
odfalik deleted the slack-download-all-attachments branch July 8, 2026 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant