get_system_info
Retrieve comprehensive Arch Linux system information including kernel version, architecture, hostname, uptime, memory, disk usage, pacman version, and installed packages count for monitoring and diagnostics.
Instructions
[MONITORING] Get comprehensive system information including kernel version, architecture, hostname, uptime, and memory statistics. Works on any system. Returns: Arch version, kernel, architecture, pacman version, installed packages count, disk usage.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/arch_ops_server/system.py:23-86 (handler)The core handler function for the 'get_system_info' tool. It gathers system info (kernel, architecture, hostname, uptime, memory from /proc/meminfo, and Arch Linux detection) by running system commands and parsing files. Returns a dict with these fields.
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)}" ) - Tool input schema definition for 'get_system_info' in the MCP server's list_tools() method. Declares name, description, empty inputSchema (no arguments needed), and readOnlyHint annotation.
# System Diagnostic Tools Tool( name="get_system_info", description="[MONITORING] Get comprehensive system information including kernel version, architecture, hostname, uptime, and memory statistics. Works on any system. Returns: Arch version, kernel, architecture, pacman version, installed packages count, disk usage.", inputSchema={ "type": "object", "properties": {} }, annotations=ToolAnnotations(readOnlyHint=True) ), - src/arch_ops_server/server.py:1206-1209 (registration)Tool call dispatch registration in server.py's call_tool() function. Routes the name 'get_system_info' to call the handler function get_system_info() (no arguments) and returns the result as JSON.
# System Diagnostic Tools 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:42-57 (registration)Public API export: get_system_info is imported from .system module and listed in __all__ exports in the package's __init__.py.
from .system import ( get_system_info, check_disk_space, get_pacman_cache_stats, analyze_storage, check_failed_services, get_boot_logs, diagnose_system, ) from .system_health_check import run_system_health_check from .news import get_latest_news, check_critical_news, get_news_since_last_update, fetch_news from .logs import ( get_transaction_history, find_when_installed, find_failed_transactions, get_database_sync_history, - Metadata registration for 'get_system_info' in the TOOL_METADATA dictionary: category='monitoring', platform='any', permission='read', workflow='diagnose', related tools include 'analyze_storage' and 'check_failed_services'.
"get_system_info": ToolMetadata( name="get_system_info", category="monitoring", platform="any", permission="read", workflow="diagnose", related_tools=["analyze_storage", "check_failed_services"], prerequisite_tools=[] ),