Skip to main content
Glama
jackalterman

Windows Diagnostics MCP Server

by jackalterman

get_shutdown_events

Retrieve shutdown and reboot events from Windows system logs to diagnose system stability. Specify the number of days back to analyze for identifying historical shutdown patterns.

Instructions

Get only shutdown and reboot events

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
daysBackNoNumber of days back to analyze (default: 7)

Implementation Reference

  • The handler function implementing the core logic for the get_shutdown_events tool. It runs a PowerShell diagnostic script to retrieve shutdown events over a specified period and formats them into a markdown response.
    export async function getShutdownEvents(args: { daysBack?: number }) { const daysBack = args?.daysBack || 7; const result = await runPowerShellScript(DIAGNOSTIC_SCRIPT, { DaysBack: daysBack, JsonOutput: true }) as AllTypes.DiagnosticResults; return { content: [ { type: 'text', text: `# Shutdown and Reboot Events (Last ${daysBack} days)\n\n${result.ShutdownEvents.length > 0 ? result.ShutdownEvents.map((e: AllTypes.EventInfo) => `- **${e.Time}**: ${e.Description} (Event ID: ${e.EventID}, Source: ${e.Source})`).join('\n') : 'No shutdown/reboot events found in the specified period.'}\n\n**Total Events**: ${result.ShutdownEvents.length}\n**Unexpected Shutdowns**: ${result.ShutdownEvents.filter((e: AllTypes.EventInfo) => e.EventID === 6008).length}`, }, ], }; }
  • The input schema definition for the get_shutdown_events tool, registered in the ListTools handler, specifying the expected arguments.
    name: 'get_shutdown_events', description: 'Get only shutdown and reboot events', inputSchema: { type: 'object', properties: { daysBack: { type: 'number', description: 'Number of days back to analyze (default: 7)', default: 7, }, }, }, },
  • src/index.ts:541-542 (registration)
    The registration and dispatch logic in the CallToolRequestSchema handler that routes calls to the getShutdownEvents function in diagnostics module.
    case 'get_shutdown_events': return await diagnostics.getShutdownEvents(args as { daysBack?: number });

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jackalterman/windows-diagnostic-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server