chronica_search
Search saved entries by content, tags, or type to retrieve stored memories and information from the Chronica persistent memory system.
Instructions
保存されたエントリを検索します。本文・タグ・種別を含むエントリ一覧を返します。
【記憶の閲覧・一覧(save と対になる操作)】
「記憶を見せて」「保存したものを一覧」「Chronicaに何が入ってる?」「最近の記録」では、 フィルタなしで呼び出す(引数は空オブジェクト {} または limit のみ)。 全スレッド横断で、保存日時の新しい順に最大100件が返る。
chronica_list_threads はスレッド名・件数・ID のみ。本文は含まれない。 本文を一覧・紹介するには必ず本ツール(search)を使う。特定スレッドだけなら thread_id を指定。
【使用タイミング】
ユーザーが「最近の〜を振り返りたい」と言ったとき
特定のタグやトピックの記録を探すとき
【能動的な記憶参照】
ユーザーの発言に既存の記憶と関連しそうなテーマが出てきたら、 会話を止めずに裏側でsearchを呼ぶこと。
関連記憶が見つかった場合、「Chronicaによると〜」等のメタ発言は不要。 その記憶を自然に会話に織り込む。
例:ユーザーが仕事の悩みを話す → 過去の関連決定事項を検索 → 「以前〇〇と決めていましたよね」と自然につなげる。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| thread_id | No | スレッドID(指定時はthread_typeより優先) | |
| thread_type | No | スレッドタイプ | |
| kind | No | エントリ種別 | |
| tags | No | タグリスト(いずれか一致) | |
| project | No | プロジェクト名 | |
| limit | No | 最大件数(省略時100)。一覧表示時も指定可。 |
Implementation Reference
- src/chronica/tools.py:378-397 (handler)The implementation of the `chronica_search` handler in `src/chronica/tools.py`. It uses the `store.search` method to retrieve entries based on provided arguments.
elif name == "chronica_search": thread_type = arguments.get("thread_type") if thread_type and 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) )] entries = store.search( thread_id=arguments.get("thread_id"), thread_type=thread_type, kind=arguments.get("kind"), tags=arguments.get("tags"), project=arguments.get("project"), limit=arguments.get("limit", 100) ) return [types.TextContent( type="text", text=json.dumps({"entries": entries}, ensure_ascii=False, indent=2) )] - src/chronica/tools.py:54-109 (registration)The registration of the `chronica_search` tool within the `list_tools` function in `src/chronica/tools.py`, including its schema definition.
types.Tool( name="chronica_search", description=""" 保存されたエントリを検索します。本文・タグ・種別を含むエントリ一覧を返します。 【記憶の閲覧・一覧(save と対になる操作)】 - 「記憶を見せて」「保存したものを一覧」「Chronicaに何が入ってる?」「最近の記録」では、 フィルタなしで呼び出す(引数は空オブジェクト {} または limit のみ)。 全スレッド横断で、保存日時の新しい順に最大100件が返る。 - chronica_list_threads はスレッド名・件数・ID のみ。本文は含まれない。 本文を一覧・紹介するには必ず本ツール(search)を使う。特定スレッドだけなら thread_id を指定。 【使用タイミング】 - ユーザーが「最近の〜を振り返りたい」と言ったとき - 特定のタグやトピックの記録を探すとき 【能動的な記憶参照】 - ユーザーの発言に既存の記憶と関連しそうなテーマが出てきたら、 会話を止めずに裏側でsearchを呼ぶこと。 - 関連記憶が見つかった場合、「Chronicaによると〜」等のメタ発言は不要。 その記憶を自然に会話に織り込む。 - 例:ユーザーが仕事の悩みを話す → 過去の関連決定事項を検索 → 「以前〇〇と決めていましたよね」と自然につなげる。 """, inputSchema={ "type": "object", "properties": { "thread_id": { "type": "string", "description": "スレッドID(指定時はthread_typeより優先)" }, "thread_type": { "type": "string", "enum": ["normal", "project"], "description": "スレッドタイプ" }, "kind": { "type": "string", "description": "エントリ種別" }, "tags": { "type": "array", "items": {"type": "string"}, "description": "タグリスト(いずれか一致)" }, "project": { "type": "string", "description": "プロジェクト名" }, "limit": { "type": "integer", "description": "最大件数(省略時100)。一覧表示時も指定可。" } } } ),