Skip to main content
Glama

list-hosts

Returns all UniFi console hosts, including UDM, UDM Pro, and Cloud Key models. Required for inventory or mapping your network hardware.

Instructions

List all UniFi console hosts (UDM, UDM Pro, Cloud Key, etc.)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
extractFieldsNoComma-separated dotted paths to project from response (e.g. 'id,name,owner.name,columns.*.name'). Use `*` as wildcard for arrays/objects. Wrap field names with dots in backticks. Reduces response tokens dramatically on large entities.

Implementation Reference

  • The listHosts async function that executes the tool logic. Calls GET /hosts via unifiClient, optionally extracts fields, or returns a default set of fields (id, hostname, state, hardware shortname, firmware version).
    export async function listHosts(params: z.infer<typeof listHostsSchema> = {}) {
      const response = await unifiClient.get<{ data: unknown[] }>("/hosts");
      if (params.extractFields) return response.data;
      return applyExtractFields(
        response.data,
        "*.id,*.reportedState.hostname,*.reportedState.state,*.reportedState.hardware.shortname,*.reportedState.firmwareVersion",
      );
    }
  • Zod schema for list-hosts input validation. Accepts an optional extractFields string for field filtering.
    export const listHostsSchema = z.object({
      extractFields: ef,
    });
  • src/index.ts:109-111 (registration)
    Registration of the 'list-hosts' tool with the MCP server. Calls tool() which registers it in the 'raw' category and calls server.tool() with the schema and wrapped handler.
    tool("list-hosts",
      "List all UniFi console hosts (UDM, UDM Pro, Cloud Key, etc.)",
      listHostsSchema.shape, wrapToolHandler(listHosts));
  • src/index.ts:21-21 (registration)
    Import of listHostsSchema and listHosts from ./tools/hosts.js
    import { listHostsSchema, listHosts, getHostSchema, getHost } from "./tools/hosts.js";
Behavior3/5

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

No annotations are provided, so the description must disclose behavioral traits. It implies a read-only listing but does not explicitly state authorization needs, rate limits, or side effects. For a simple list operation, this is minimally adequate.

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 sentence that directly conveys the purpose without any extraneous words. It is front-loaded and highly efficient.

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

Completeness4/5

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

Given the tool's simplicity (one optional parameter, no output schema), the description covers the essential purpose. It could mention the return format or fields, but the context is largely complete for an agent to understand usage.

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

Parameters3/5

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

Input schema coverage is 100%, so the schema already documents the 'extractFields' parameter in detail. The description does not add any additional meaning about parameters, which is acceptable per the rubric's baseline of 3.

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

Purpose5/5

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

The description clearly states the verb 'List' and the resource 'all UniFi console hosts', specifying examples like UDM, UDM Pro, Cloud Key. It effectively distinguishes from sibling tools such as 'get-host' which retrieves a single host.

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

Usage Guidelines4/5

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

The description explicitly states when to use the tool (to list all console hosts), providing clear context. However, it does not offer exclusions or mention alternatives beyond the implicit distinction from siblings.

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/us-all/unifi-mcp-server'

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