get_system_diagnostics
Retrieve detailed Windows system diagnostics, including crash reports, reboots, and system health analysis. Specify days back and toggle detailed event data for in-depth troubleshooting.
Instructions
Get comprehensive Windows system diagnostics including crashes, reboots, and system health
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_system_diagnostics"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| daysBack | No | Number of days back to analyze (default: 7) | |
| detailed | No | Include detailed event information |
Implementation Reference
- src/tools/diagnostics.ts:11-31 (handler)The main handler function getSystemDiagnostics that runs a PowerShell diagnostic script, processes results, and formats a comprehensive system health report.
export async function getSystemDiagnostics(args: { daysBack?: number; detailed?: boolean }) { const daysBack = args?.daysBack || 7; const detailed = args?.detailed || false; const params = { DaysBack: daysBack, JsonOutput: true, ...(detailed && { Detailed: true }) }; const result = await runPowerShellScript(DIAGNOSTIC_SCRIPT, params) as AllTypes.DiagnosticResults; return { content: [ { type: 'text', text: `# Windows System Diagnostics Report\n\n## Summary\n- **Analysis Period**: ${result.Summary.AnalysisPeriodDays} days\n- **Total Events**: ${result.Summary.TotalEventsAnalyzed}\n- **Critical BSOD Events**: ${result.Summary.CriticalBSODCount}\n- **Unexpected Shutdowns**: ${result.Summary.UnexpectedShutdownCount}\n- **Application Crashes**: ${result.Summary.TotalApplicationCrashes}\n- **Generated**: ${result.Summary.GeneratedAt}\n\n## System Information\n- **OS**: ${result.SystemInfo.OSVersion}\n- **Last Boot**: ${result.SystemInfo.LastBootTime}\n- **Current Uptime**: ${result.SystemInfo.CurrentUptimeDays} days, ${result.SystemInfo.CurrentUptimeHours} hours, ${result.SystemInfo.CurrentUptimeMinutes} minutes\n- **Total Memory**: ${result.SystemInfo.TotalMemoryGB} GB\n- **Reboots in Period**: ${result.SystemInfo.RebootCountInPeriod}\n\n## Critical Events\n${result.BSODEvents.length > 0 ? `### BSOD Events (⚠️ Critical)\n${result.BSODEvents.map((e: AllTypes.EventInfo) => `- **${e.Time}**: ${e.Description} (Event ID: ${e.EventID})`).join('\n')}` : '### BSOD Events\n- No BSOD events found ✅'}\n\n${result.ShutdownEvents.filter((e: AllTypes.EventInfo) => e.EventID === 6008).length > 0 ? `### Unexpected Shutdowns (⚠️ Warning)\n${result.ShutdownEvents.filter((e: AllTypes.EventInfo) => e.EventID === 6008).map((e: AllTypes.EventInfo) => `- **${e.Time}**: ${e.Description}`).join('\n')}` : '### Unexpected Shutdowns\n- No unexpected shutdowns found ✅'}\n\n## Application Crashes\n${result.ApplicationCrashes.length > 0 ? result.ApplicationCrashes.map((c: AllTypes.ApplicationCrash) => `- **${c.Application}**: ${c.CrashCount} crashes (Latest: ${c.LatestCrash})`).join('\n') : '- No application crashes found ✅'}\n\n## Hardware & Driver Issues\n${result.HardwareErrors.length > 0 ? `### Hardware Errors\n${result.HardwareErrors.map((e: AllTypes.HardwareError) => `- **${e.Time}**: ${e.Source}`).join('\n')}` : '### Hardware Errors\n- No hardware errors found ✅'}\n\n${result.DriverIssues.length > 0 ? `### Driver Issues\n${result.DriverIssues.map((d: AllTypes.DriverIssue) => `- **${d.DriverService}**: ${d.IssueCount} issues`).join('\n')}` : '### Driver Issues\n- No driver issues found ✅'}\n\n## Memory Dumps\n${result.MemoryDumps.length > 0 ? result.MemoryDumps.map((d: AllTypes.MemoryDump) => `- **${d.Type} Dump**: ${d.Path} (Last Modified: ${d.LastWrite}, Size: ${d.SizeMB || d.SizeKB} ${d.SizeMB ? 'MB' : 'KB'})`).join('\n') : '- No memory dumps found'}\n\n## Recent System Events\n${result.ShutdownEvents.slice(0, 5).map((e: AllTypes.EventInfo) => `- **${e.Time}**: ${e.Description} (Event ID: ${e.EventID})`).join('\n')}`, }, ], }; } - src/index.ts:50-67 (schema)The input schema definition for the get_system_diagnostics tool, specifying parameters daysBack and detailed.
name: 'get_system_diagnostics', description: 'Get comprehensive Windows system diagnostics including crashes, reboots, and system health', inputSchema: { type: 'object', properties: { daysBack: { type: 'number', description: 'Number of days back to analyze (default: 7)', default: 7, }, detailed: { type: 'boolean', description: 'Include detailed event information', default: false, }, }, }, }, - src/index.ts:539-541 (registration)The switch case in the CallToolRequestHandler that routes calls to the getSystemDiagnostics handler.
case 'get_system_diagnostics': return await diagnostics.getSystemDiagnostics(args as { daysBack?: number; detailed?: boolean }); case 'get_shutdown_events': - src/index.ts:9-9 (registration)Import of the diagnostics module containing the tool handler.
import * as diagnostics from './tools/diagnostics.js';