openwrt_get_system_info
Retrieve system status details like board information, uptime, memory usage, and CPU load from an OpenWRT router via SSH for monitoring and troubleshooting.
Instructions
Get comprehensive system information including board details, uptime, memory usage, and CPU load
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- openwrt_ssh_mcp/tools.py:49-93 (handler)The main implementation of get_system_info() in the OpenWRTTools class. Executes multiple commands (ubus call system board, ubus call system info, cat /proc/uptime, cat /proc/loadavg) to gather comprehensive system information, parses JSON output from ubus commands, and returns a structured response with board details, system info, uptime, and load average.@staticmethod async def get_system_info() -> dict[str, Any]: """ Get OpenWRT system information (uptime, memory, load). Returns: dict: System information """ try: await ssh_client.ensure_connected() # Execute multiple commands to gather system info commands = { "board": "ubus call system board", "info": "ubus call system info", "uptime": "cat /proc/uptime", "loadavg": "cat /proc/loadavg", } results = {} for key, cmd in commands.items(): result = await ssh_client.execute(cmd) if result["success"]: if key in ["board", "info"]: # Parse JSON output from ubus try: results[key] = json.loads(result["stdout"]) except json.JSONDecodeError: results[key] = result["stdout"] else: results[key] = result["stdout"] else: results[key] = {"error": result["stderr"]} return { "success": True, "system_info": results, } except Exception as e: logger.error(f"Failed to get system info: {e}") return { "success": False, "error": str(e), }
- openwrt_ssh_mcp/server.py:62-73 (schema)Tool registration schema defining openwrt_get_system_info with name, description, and inputSchema. The tool accepts no input parameters (empty properties and required arrays) and returns comprehensive system information including board details, uptime, memory usage, and CPU load.Tool( name="openwrt_get_system_info", description=( "Get comprehensive system information including board details, " "uptime, memory usage, and CPU load" ), inputSchema={ "type": "object", "properties": {}, "required": [], }, ),
- openwrt_ssh_mcp/server.py:304-305 (registration)Routing logic in the call_tool handler that maps 'openwrt_get_system_info' requests to the OpenWRTTools.get_system_info() method implementation.elif name == "openwrt_get_system_info": result = await OpenWRTTools.get_system_info()