From 0840b76a67ee95e4baf68ee032497f93e42ee987 Mon Sep 17 00:00:00 2001 From: mxl Date: Mon, 16 Mar 2026 19:00:50 -0700 Subject: [PATCH] Update README for public chat search limit --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 752d524..3109466 100644 --- a/README.md +++ b/README.md @@ -116,7 +116,7 @@ This MCP server exposes a huge suite of Telegram tools. **Every major Telegram/T - **edit_chat_photo(chat_id, file_path)**: Update chat photo from allowed roots ### Search & Discovery -- **search_public_chats(query)**: Search public chats/channels/bots +- **search_public_chats(query, limit)**: Search public chats/channels/bots with a configurable result limit - **search_messages(chat_id, query, limit)**: Search messages in a chat - **resolve_username(username)**: Resolve a username to ID @@ -533,13 +533,14 @@ Successfully joined chat: Developer Community ```python @mcp.tool() -async def search_public_chats(query: str) -> str: +async def search_public_chats(query: str, limit: int = 20) -> str: """ Search for public chats, channels, or bots by username or title. """ try: - result = await client(functions.contacts.SearchRequest(q=query, limit=20)) - return json.dumps([format_entity(u) for u in result.users], indent=2) + result = await client(functions.contacts.SearchRequest(q=query, limit=limit)) + entities = [format_entity(e) for e in result.chats + result.users] + return json.dumps(entities, indent=2) except Exception as e: return f"Error searching public chats: {e}" ```