search
Search Claude Code session history using natural language queries to find specific events, discussions, or file interactions with optional filtering by session, project, or event type.
Instructions
Semantic search across all stored Claude Code session events. Returns events matching a natural language query, with optional filters by event type, session, project, tool, or file path. IMPORTANT: Always pass session_id when you know which session to search — unscoped search returns noisy results. For finding a discussion WITH surrounding conversation context, use search_in_context instead.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Natural language query | |
| limit | No | Max results (default 10) | |
| session_id | No | Scope search to a single session (prefix match) | |
| project_id | No | Scope search to a project by project_id | |
| project_name | No | Scope search to a project by name substring (e.g. 'gonzo') | |
| event_type | No | Filter: user_message, assistant_text, assistant_thinking, tool_call, tool_result | |
| tool_name | No | Filter by tool name (Edit, Bash, Read, etc.) | |
| file_path_contains | No | Filter to events with an explicit file_path containing this string (tool_call/tool_result events only — user messages won't have file_path metadata) | |
| max_chars | No | Max total output characters (default 12000). Set higher if you need full content. |