Skip to main content
Glama
nntkio

UniFi MCP Server

by nntkio

get_site_health

Check the health status of a UniFi network site to monitor connectivity, device status, and overall network performance.

Instructions

Get health status for the current site

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler dispatch for get_site_health: calls UniFiClient.get_site_health() and formats the response using format_health.
    case "get_site_health": health = await client.get_site_health() return [TextContent(type="text", text=format_health(health))]
  • Tool schema definition including name, description, and empty input schema (no parameters required).
    Tool( name="get_site_health", description="Get health status for the current site", inputSchema={ "type": "object", "properties": {}, "required": [], }, ),
  • UniFiClient method that performs the actual API request to retrieve site health data from the controller.
    async def get_site_health(self) -> list[dict[str, Any]]: """Get site health statistics. Returns: List of health metric dictionaries. """ return await self._request("GET", "/api/s/{site}/stat/health")
  • Formats raw health data from UniFi API into human-readable text, categorizing by subsystems like WAN, WLAN, LAN.
    def format_health(health: list[dict[str, Any]]) -> str: """Format health data for display.""" if not health: return "No health data available." lines = ["Site Health Status:\n"] for subsystem in health: subsys_name = subsystem.get("subsystem", "Unknown") status = subsystem.get("status", "unknown") lines.append(f"- {subsys_name.upper()}") lines.append(f" Status: {status}") if subsys_name == "wan": gateways = subsystem.get("gw_mac", "N/A") lines.append(f" Gateway: {gateways}") elif subsys_name == "wlan": num_ap = subsystem.get("num_ap", 0) num_user = subsystem.get("num_user", 0) lines.append(f" Access Points: {num_ap}") lines.append(f" Wireless Clients: {num_user}") elif subsys_name == "lan": num_sw = subsystem.get("num_sw", 0) num_user = subsystem.get("num_user", 0) lines.append(f" Switches: {num_sw}") lines.append(f" Wired Clients: {num_user}") lines.append("") return "\n".join(lines)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nntkio/unifiMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server