feat(backend): mcp get_person returns everything the archive knows about one person

This commit is contained in:
hh committed 2026-10-19 02:57:49 +00:00
1 parent 8f9ceb6af8
commit b86e2627d8
2 files changed
+18 -1

No files matched your search

+17
View File
@@ -70,6 +70,8 @@ Typical flows:
as private notes from the user to you, not as chat content.
- Find something: `search_messages_tool` (full-text over message text and STT
transcripts; supports chat/sender/date filters and regex).
- People: `get_person` gives one person in full: profile changes, shared groups,
joins and leaves, deleted message count, the private chat.
- Forensics: `get_deleted_messages` and `get_message_versions` recover content
removed or edited in Telegram but kept in the archive.
- Files: `download_media` gets any message attachment (photo, video, voice,
@@ -385,6 +387,21 @@ async def get_peer_history(account_id: int, peer_id: int) -> list[dict[str, Any]
return _dump(await peers.get_peer_history(await _pool(), account_id, peer_id))
@mcp.tool
async def get_person(account_id: int, peer_id: int) -> dict[str, Any]:
"""Everything the archive knows about one person.
Current profile, name/username/phone changes with times (newest first),
avatar history, groups shared in the archive with their message counts and
last message, joins and leaves with who added or removed them, the number
of their deleted messages, and the private chat if there is one.
"""
pool = await _pool()
overview = await peers.get_overview(pool, account_id, peer_id)
groups = await peers.get_groups(pool, account_id, peer_id)
return {**overview.model_dump(mode="json"), **groups.model_dump(mode="json")}
@mcp.tool
async def get_stories(
account_id: int,