get_system_stats
Retrieve ComfyUI server health metrics including version details, memory usage, and device information to monitor system status and resource utilization.
Instructions
Get ComfyUI server health: version, memory, device info.
Returns system information including:
- ComfyUI and PyTorch versions
- RAM usage
- Device info (CPU/GPU)
Use this to verify ComfyUI is running and check resource usage.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- MCP tool handler for get_system_stats. Fetches and validates ComfyUI system statistics, decorated with @mcp.tool() for automatic registration.@mcp.tool() def get_system_stats(ctx: Context) -> dict: """Get ComfyUI server health: version, memory, device info. Returns system information including: - ComfyUI and PyTorch versions - RAM usage - Device info (CPU/GPU) Use this to verify ComfyUI is running and check resource usage. """ ctx.info("Fetching system stats...") try: data = comfy_get("/system_stats") stats = SystemStats(**data) return stats.model_dump() except Exception as e: return ErrorResponse.unavailable(str(e)).model_dump()
- src/comfy_mcp_server/models.py:46-51 (schema)Pydantic model used to validate and structure the response from ComfyUI's /system_stats endpoint.class SystemStats(BaseModel): """Complete system statistics from /system_stats.""" system: SystemInfo devices: list[DeviceInfo]
- src/comfy_mcp_server/tools/__init__.py:23-28 (registration)Registers the system tools (including get_system_stats) by calling register_system_tools(mcp).def register_all_tools(mcp): """Register all tools with the MCP server.""" register_system_tools(mcp) register_discovery_tools(mcp) register_workflow_tools(mcp) register_execution_tools(mcp)
- src/comfy_mcp_server/__init__.py:91-92 (registration)Top-level registration of all MCP tools during server setup, which includes the system tools.# Register all tools register_all_tools(mcp)
- src/comfy_mcp_server/api.py:209-211 (helper)API helper function providing a convenient wrapper for fetching system stats via ComfyUI's /system_stats endpoint.def get_system_stats() -> dict: """Get ComfyUI system statistics.""" return comfy_get("/system_stats")