analyze_target
Analyze Linux system crash dumps by setting up a session with vmcore and vmlinux files to enable subsequent diagnostic commands.
Instructions
Starts a crash analysis session with explicit vmcore and vmlinux paths.
This sets the default active session, so subsequent commands (run_crash_command)
don't need to specify a session_id.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| vmcore_path | Yes | ||
| vmlinux_path | Yes |
Implementation Reference
- src/crash_mcp/server.py:95-107 (handler)The handler function decorated with @mcp.tool() that implements the analyze_target tool. It initializes a CrashSession with the given vmcore and vmlinux paths using the helper _start_session_internal.@mcp.tool() def analyze_target(vmcore_path: str, vmlinux_path: str) -> str: """ Starts a crash analysis session with explicit vmcore and vmlinux paths. This sets the default active session, so subsequent commands (run_crash_command) don't need to specify a session_id. """ try: session_id = _start_session_internal(vmcore_path, vmlinux_path) return f"Analysis started for {vmcore_path}. Session ID: {session_id}. You can now run commands." except Exception as e: return f"Failed to start analysis: {str(e)}"
- src/crash_mcp/server.py:54-81 (helper)Internal helper function called by analyze_target to create and manage the CrashSession, handling kernel auto-matching if needed.def _start_session_internal(dump_path: str, kernel_path: Optional[str] = None) -> str: """Helper to start session and update global state.""" global last_session_id if not os.path.exists(dump_path): return f"Error: Dump file not found at {dump_path}" if not kernel_path: # Try to auto-match kernel_path = CrashDiscovery.match_kernel(dump_path, [os.path.dirname(dump_path)]) if kernel_path: logger.info(f"Auto-matched kernel: {kernel_path}") else: logger.warning("No matching kernel found automatically.") session_id = str(uuid.uuid4()) logger.info(f"Starting session {session_id} for {dump_path}") try: session = CrashSession(dump_path, kernel_path) session.start() sessions[session_id] = session last_session_id = session_id # Update default session return session_id except Exception as e: logger.error(f"Failed to start session: {e}") raise e