get_system_info
Retrieve comprehensive system details including kernel version, architecture, hostname, uptime, and memory statistics for system analysis and troubleshooting.
Instructions
Get comprehensive system information including kernel version, architecture, hostname, uptime, and memory statistics. Works on any system.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/arch_ops_server/system.py:23-87 (handler)The core handler function that executes the get_system_info tool, gathering kernel version, architecture, hostname, uptime, memory usage, and Arch Linux detection.async def get_system_info() -> Dict[str, Any]: """ Get core system information. Returns: Dict with kernel, architecture, hostname, uptime, memory info """ logger.info("Gathering system information") info = {} try: # Kernel version exit_code, stdout, _ = await run_command(["uname", "-r"], timeout=5, check=False) if exit_code == 0: info["kernel"] = stdout.strip() # Architecture exit_code, stdout, _ = await run_command(["uname", "-m"], timeout=5, check=False) if exit_code == 0: info["architecture"] = stdout.strip() # Hostname exit_code, stdout, _ = await run_command(["hostname"], timeout=5, check=False) if exit_code == 0: info["hostname"] = stdout.strip() # Uptime exit_code, stdout, _ = await run_command(["uptime", "-p"], timeout=5, check=False) if exit_code == 0: info["uptime"] = stdout.strip() # Memory info from /proc/meminfo try: meminfo_path = Path("/proc/meminfo") if meminfo_path.exists(): with open(meminfo_path, "r") as f: meminfo = f.read() # Parse memory values mem_total_match = re.search(r"MemTotal:\s+(\d+)", meminfo) mem_available_match = re.search(r"MemAvailable:\s+(\d+)", meminfo) if mem_total_match: info["memory_total_kb"] = int(mem_total_match.group(1)) info["memory_total_mb"] = int(mem_total_match.group(1)) // 1024 if mem_available_match: info["memory_available_kb"] = int(mem_available_match.group(1)) info["memory_available_mb"] = int(mem_available_match.group(1)) // 1024 except Exception as e: logger.warning(f"Failed to read memory info: {e}") info["is_arch_linux"] = IS_ARCH logger.info("Successfully gathered system information") return info except Exception as e: logger.error(f"Failed to gather system info: {e}") return create_error_response( "SystemInfoError", f"Failed to gather system information: {str(e)}" )
- src/arch_ops_server/server.py:896-903 (registration)Registers the get_system_info tool in the MCP server's list_tools() method, including its description and empty input schema (no parameters required).Tool( name="get_system_info", description="[MONITORING] Get comprehensive system information including kernel version, architecture, hostname, uptime, and memory statistics. Works on any system.", inputSchema={ "type": "object", "properties": {} } ),
- src/arch_ops_server/server.py:1333-1335 (registration)The dispatch logic in the MCP server's call_tool() method that invokes the get_system_info handler and formats the JSON response.elif name == "get_system_info": result = await get_system_info() return [TextContent(type="text", text=json.dumps(result, indent=2))]
- Metadata definition for the get_system_info tool, categorizing it as monitoring/diagnose with related tools."get_system_info": ToolMetadata( name="get_system_info", category="monitoring", platform="any", permission="read", workflow="diagnose", related_tools=["check_disk_space", "check_failed_services"], prerequisite_tools=[]