feat(backend): mcp get_person returns everything the archive knows about one person
This commit is contained in:
1 parent
8f9ceb6af8
commit
b86e2627d8
2 files changed
+18
-1
No files matched your search
@@ -24,7 +24,7 @@ Nothing is ever deleted from the archive.
|
||||
|
||||
## MCP
|
||||
|
||||
Read-only: `list_watched_bots`, `get_bot_stats`, `get_bot_updates`, `search_messages_tool`, `list_chats`, `get_chat_history` (with deleted messages included), `get_deleted_messages`, `get_message_versions`, `get_media`, `get_callbacks`, `presence_history`, `presence_stats`, `get_peer_history`, `get_stories`, `get_annotations`, `list_watches`, `list_alerts`. The one write is `set_watch`. There are no send, edit or delete tools and there will not be.
|
||||
Read-only: `list_watched_bots`, `get_bot_stats`, `get_bot_updates`, `search_messages_tool`, `list_chats`, `get_chat_history` (with deleted messages included), `get_deleted_messages`, `get_message_versions`, `get_media`, `get_callbacks`, `presence_history`, `presence_stats`, `get_peer_history`, `get_person`, `get_stories`, `get_annotations`, `list_watches`, `list_alerts`. The one write is `set_watch`. There are no send, edit or delete tools and there will not be.
|
||||
|
||||
## Run
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user