get_system_info
Retrieve system details like kernel version, architecture, hostname, uptime, and memory statistics for monitoring and troubleshooting purposes.
Instructions
[MONITORING] 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)Core handler function that executes the get_system_info tool: gathers kernel version, architecture, hostname, uptime, memory stats using system commands and /proc/meminfo.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)}" )
- MCP Tool schema definition in server.list_tools(): empty input schema (no parameters) and description for get_system_info.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-1336 (registration)Tool call dispatcher in server.call_tool(): invokes the get_system_info handler function.elif name == "get_system_info": result = await get_system_info() return [TextContent(type="text", text=json.dumps(result, indent=2))]
- src/arch_ops_server/__init__.py:39-40 (registration)Imports the get_system_info function from system.py for exposure via __init__.from .system import ( get_system_info,
- ToolMetadata providing category (monitoring), platform (any), permissions (read), workflow (diagnose), and related tools for get_system_info."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=[] ),