chronica_get_last_seen
Retrieve the last seen timestamp for specified thread types to maintain context across sessions in persistent memory systems.
Instructions
指定されたスレッドタイプで最後に見た時刻を取得します。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| thread_type | Yes | スレッドタイプ(必須) |
Implementation Reference
- src/chronica/tools.py:419-438 (handler)The tool handler for "chronica_get_last_seen" which retrieves the last seen time for a given thread_type from the store.
elif name == "chronica_get_last_seen": thread_type = arguments.get("thread_type") if not thread_type: return [types.TextContent( type="text", text=json.dumps({"error": "invalid_thread", "message": "thread_type is required"}, ensure_ascii=False) )] if thread_type not in ["normal", "project"]: return [types.TextContent( type="text", text=json.dumps({"error": "invalid_thread", "message": f"thread_type must be 'normal' or 'project', got: {thread_type}"}, ensure_ascii=False) )] last_seen_time = store.get_last_seen(thread_type) result = {"last_seen_time": last_seen_time} if last_seen_time else {"last_seen_time": None} return [types.TextContent( type="text", text=json.dumps(result, ensure_ascii=False) )] - src/chronica/store.py:278-292 (helper)The helper method that executes the SQLite query to retrieve the last seen timestamp for a specific thread_type.
def get_last_seen(self, thread_type: str) -> Optional[str]: """最後に見た時刻を取得""" conn = sqlite3.connect(str(self.db_path)) cursor = conn.cursor() cursor.execute(""" SELECT saved_time FROM entries WHERE thread_type = ? ORDER BY saved_time DESC LIMIT 1 """, (thread_type,)) row = cursor.fetchone() conn.close() return row[0] if row else None - src/chronica/tools.py:150-163 (registration)Tool registration for "chronica_get_last_seen" in the tool list definition.
name="chronica_get_last_seen", description="指定されたスレッドタイプで最後に見た時刻を取得します。", inputSchema={ "type": "object", "properties": { "thread_type": { "type": "string", "enum": ["normal", "project"], "description": "スレッドタイプ(必須)" } }, "required": ["thread_type"] } ),