Windows-uptime
Get the current uptime of the Windows system to track duration since last boot.
Instructions
Get the uptime of the Windows system
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": "Windows-uptime"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- main.py:70-73 (registration)Registration of the 'Windows-uptime' tool via @mcp.tool decorator with name and description attributes.
@mcp.tool( name="Windows-uptime", description="Get the uptime of the Windows system", ) - main.py:74-83 (handler)Handler function 'get_windows_uptime' that calculates system uptime using psutil.boot_time() and time.time().
def get_windows_uptime() -> str: """Get the uptime of the Windows system.""" import psutil import time try: uptime_seconds = time.time() - psutil.boot_time() return f"Uptime: {uptime_seconds:.0f} seconds" except Exception as e: return f"Error retrieving uptime: {e}"