Skip to content

feat: expose birthday in get_full_user - #131

Merged
chigwell merged 1 commit into
chigwell:mainfrom
akhromovRT:feat/expose-birthday-in-get-full-user
May 26, 2026
Merged

feat: expose birthday in get_full_user#131
chigwell merged 1 commit into
chigwell:mainfrom
akhromovRT:feat/expose-birthday-in-get-full-user

Conversation

@akhromovRT

Copy link
Copy Markdown
Contributor

What

Surfaces birthday from UserFull in the get_full_user tool output.

Why

Telethon's UserFull.birthday exposes the contact's date of birth when:

  • the user has Telegram Premium,
  • has set a birthday on their profile, and
  • has allowed contacts to see it.

The year component is optional (often hidden by the user). Currently get_full_user does not expose this field, even though it sits right next to fields the tool already surfaces (bio, personal_channel, verified, premium, common_chats_count).

How

Adds 18 lines inside get_full_user (telegram_mcp/tools/profile.py):

  • reads full_user.birthday via getattr (forward-compatible if Telethon ever omits the attribute),
  • formats output as ISO 8601 YYYY-MM-DD when the year is present,
  • falls back to vCard RFC 6350 --MM-DD for year-less dates,
  • emits None when birthday is unavailable.

The new field is placed next to personal_channel in the result dict, keeping the order logical.

Testing

  • PYTHONPATH=. uv run pytest -q --ignore=tests/test_media_album.py99/99 passed on this branch.
  • tests/test_media_album.py shows 6 pre-existing failures on origin/main (verified by stashing the patch and re-running on a clean checkout) — they are infra-related (Error: 'account' is required) and unrelated to this change.
  • Manual verification on a Premium contact with a set birthday: confirms a non-null birthday field in the tool output.

Notes

Follows the same minimal-patch style as #128 (fix: handle MessageReplyStoryHeader without reply_to_msg_id attribute).

Telethon's UserFull has a 'birthday' field for Premium users who set it
and allow contacts to see it. Surface it from get_full_user so MCP
consumers can read birthday data alongside other profile fields.

Format:
- ISO 8601 'YYYY-MM-DD' when year is present
- vCard RFC 6350 style '--MM-DD' for year-less dates
- None when birthday is unavailable or the user is not Premium /
  has not shared it
@chigwell
chigwell merged commit 4d86231 into chigwell:main May 26, 2026
4 checks passed
KiaroSama pushed a commit to KiaroSama/telegram-mcp that referenced this pull request Aug 25, 2026
…in-get-full-user

feat: expose birthday in get_full_user
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.

2 participants