Skip to content

Add Telegram album sending tool - #127

Merged
chigwell merged 1 commit into
chigwell:mainfrom
JosXa:send-album
May 24, 2026
Merged

Add Telegram album sending tool#127
chigwell merged 1 commit into
chigwell:mainfrom
JosXa:send-album

Conversation

@JosXa

@JosXa JosXa commented May 16, 2026

Copy link
Copy Markdown

Summary

Adds a send_album media tool that sends 2-10 local files as a single Telegram media group while reusing the existing allowed-root file validation used by send_file.

Testing

PYTHONPATH=/projects/telegram-mcp.worktrees/send-album /projects/telegram-mcp/.venv/bin/python -m pytest /projects/telegram-mcp.worktrees/send-album/tests/test_media_album.py

@chigwell

chigwell commented May 18, 2026

Copy link
Copy Markdown
Owner

@JosXa, thank you for the contribution! Could I please ask you to fix the black formatting so the CI tests will pass? Thank you!

@konser80

Copy link
Copy Markdown

Tested this approach end-to-end and it works great — sent a real 9-photo album to a public group via Telethon's client.send_file(entity, [paths], caption=...), which is exactly what this PR wraps. All 9 images arrived as a single media group with the caption on the first item. 👍

One small thought for consideration: instead of (or in addition to) a separate send_album tool, send_file's file_path could accept Union[str, List[str]] — a list triggers album mode, a string keeps the current behavior. That avoids a second tool while staying backward-compatible. Either way, having album support merged would be very welcome.

@JosXa

JosXa commented May 24, 2026

Copy link
Copy Markdown
Author

Thanks @konser80 — I incorporated your suggestion: send_file now accepts either a single path or a list of 2–10 paths, with a list delegating to album/media-group mode while preserving the existing single-file behavior. I kept send_album as an explicit convenience tool as well.

Also addressed the earlier formatting/CI concern from @chigwell.

Verification performed locally:

  • uv run pytest tests/test_media_album.py tests/test_install_guard.py -q → 15 passed
  • uv run black --check telegram_mcp/tools/media.py tests/test_media_album.py telegram_mcp/install_guard.py tests/test_install_guard.py → unchanged
  • Live Telegram check: sent a 2-photo media group to Saved Messages via send_album('me', [...]); it returned Album sent to chat me with 2 files.

@chigwell
chigwell merged commit 4e16be8 into chigwell:main May 24, 2026
4 checks passed
KiaroSama pushed a commit to KiaroSama/telegram-mcp that referenced this pull request Aug 25, 2026
Add Telegram album sending tool
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.

3 participants