From 97c2dae082065bcc639430731da2062db077dc48 Mon Sep 17 00:00:00 2001 From: Homelab Cursor Date: Fri, 1 May 2026 12:58:12 +0200 Subject: [PATCH] chatlog_mcp: sharper tool descriptions to stop Gemini halting after list_chats - list_chats output now ends with an explicit instruction to call chatlog_recent / chatlog_since next (Gemini 2.5 Flash tends to answer after a single tool call otherwise) - list_chats description: clarify it only returns metadata, never content - recent description: marked as PREFERRED for reading actual messages --- mac-clients/chatlog_mcp.py | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/mac-clients/chatlog_mcp.py b/mac-clients/chatlog_mcp.py index 5959c30b4..a01440d29 100644 --- a/mac-clients/chatlog_mcp.py +++ b/mac-clients/chatlog_mcp.py @@ -68,6 +68,15 @@ def _format_chats(payload: dict) -> str: f"- {c.get('title') or '(ohne Titel)'} " f"(id={c['chat_id']}, {c['message_count']} Nachrichten)" ) + lines.append("") + lines.append( + "WICHTIG: Diese Liste enthaelt nur Metadaten (Titel + Anzahl). " + "Um die NACHRICHTEN selbst zu sehen, MUSST du jetzt zwingend einen " + "zweiten Tool-Call machen: chatlog_recent(chat='') " + "fuer die letzten Nachrichten ODER " + "chatlog_since(chat='', hours=24) fuer alles seit " + "den letzten 24h. Antworte NICHT bevor du das gemacht hast." + ) return "\n".join(lines) @@ -127,10 +136,12 @@ TOOLS = [ { "name": "chatlog_list_chats", "description": ( - "List every Telegram group that the Arakawa Concierge logger " - "is currently recording. Returns the chat title, internal id " - "and message count. Always call this first when you don't yet " - "know which group the user is asking about." + "Returns ONLY the metadata (title, id, message count) of every " + "Telegram group being recorded. Does NOT contain any messages. " + "Use this only when you don't know which group the user means. " + "After calling this you MUST make a second call to chatlog_recent " + "or chatlog_since to actually read the messages — the user " + "wants the conversation content, not just chat titles." ), "inputSchema": { "type": "object", @@ -141,10 +152,15 @@ TOOLS = [ { "name": "chatlog_recent", "description": ( - "Return the most recent messages of a recorded Telegram group " - "as a chronological transcript. Use this for questions like " - "'Was wurde zuletzt geschrieben?' or 'Aktueller Stand?'. " - "If 'chat' is omitted, returns recent messages across all groups." + "PREFERRED tool to actually READ the latest messages of a " + "recorded Telegram group. Returns a chronological transcript " + "with timestamps, senders and full message bodies. Use this " + "for: 'Was wurde heute / zuletzt geschrieben?', 'Aktueller " + "Stand im -Chat?', 'Was hat gesagt?'. " + "If you don't know the chat title, call chatlog_list_chats " + "first and then ALWAYS follow up with this tool. " + "If 'chat' is omitted, returns recent messages across all " + "groups (works fine when only one group is recorded)." ), "inputSchema": { "type": "object",