Skip to main content
Glama
nntkio

UniFi MCP Server

by nntkio

get_sites

Retrieve all configured UniFi network sites from the controller to manage and monitor network infrastructure.

Instructions

Get all UniFi sites configured on the controller

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler logic within the call_tool function that executes the get_sites tool by fetching sites from the UniFiClient and returning formatted TextContent.
    case "get_sites":
        sites = await client.get_sites()
        return [TextContent(type="text", text=format_sites(sites))]
  • Schema definition for the get_sites tool, specifying an empty input object schema (no parameters required).
    Tool(
        name="get_sites",
        description="Get all UniFi sites configured on the controller",
        inputSchema={
            "type": "object",
            "properties": {},
            "required": [],
        },
    ),
  • Registration of the get_sites tool in the list_tools() function, including name, description, and schema.
    Tool(
        name="get_sites",
        description="Get all UniFi sites configured on the controller",
        inputSchema={
            "type": "object",
            "properties": {},
            "required": [],
        },
    ),
  • Helper function to format the list of sites into a human-readable string for display.
    def format_sites(sites: list[dict[str, Any]]) -> str:
        """Format site list for display."""
        if not sites:
            return "No sites found."
    
        lines = [f"Found {len(sites)} site(s):\n"]
    
        for site in sites:
            name = site.get("name", "Unknown")
            desc = site.get("desc", name)
            site_id = site.get("_id", "N/A")
    
            lines.append(f"- {desc}")
            lines.append(f"  Name: {name}")
            lines.append(f"  ID: {site_id}")
            lines.append("")
    
        return "\n".join(lines)
  • UniFiClient method that implements the API call to retrieve sites from the UniFi controller.
    async def get_sites(self) -> list[dict[str, Any]]:
        """Get all sites.
    
        Returns:
            List of site dictionaries.
        """
        return await self._request("GET", "/api/self/sites")
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool retrieves data ('Get all UniFi sites'), implying a read-only operation, but doesn't clarify aspects like authentication requirements, rate limits, response format, or potential errors. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose without unnecessary words. It directly answers 'what does this tool do?' with zero waste, making it easy for an agent to parse and understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is adequate but has clear gaps. It explains the basic purpose but lacks behavioral details (e.g., response structure, error handling) that would help an agent use it correctly. For a read-only tool with no parameters, it's minimally viable but could be more informative.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, and the schema description coverage is 100% (as there are no parameters to describe). The description doesn't need to add parameter semantics beyond the schema, so it meets the baseline for tools with no parameters. No additional value is required or provided.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get') and resource ('all UniFi sites configured on the controller'), making the purpose immediately understandable. It doesn't explicitly differentiate from sibling tools like 'get_site_health', but the specificity of 'sites' versus 'site health' provides implicit distinction. The description avoids tautology by not merely restating the tool name.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, context for usage, or comparisons to siblings like 'get_site_health' or 'get_networks'. The agent must infer usage based on the tool name and description alone, which is insufficient for optimal selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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