list-sites
Retrieve a comprehensive list of all sites including device counts, WAN status, and ISP information.
Instructions
List all sites with statistics (device counts, WAN status, ISP info)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/sites.ts:6-9 (handler)The handler function for 'list-sites' tool. Calls the UniFi API GET /sites and returns the response data.
export async function listSites() { const response = await unifiClient.get<{ data: unknown[] }>("/sites"); return response.data; } - src/tools/sites.ts:4-4 (schema)Schema definition for 'list-sites' — an empty Zod object (no input parameters required).
export const listSitesSchema = z.object({}); - src/index.ts:117-119 (registration)Registration of 'list-sites' tool via the local `tool()` helper, which calls `registry.register()` and then `server.tool()` on the MCP server. Category is 'raw'.
tool("list-sites", "List all sites with statistics (device counts, WAN status, ISP info)", listSitesSchema.shape, wrapToolHandler(listSites)); - src/tools/utils.ts:5-36 (helper)The wrapToolHandler helper wraps the listSites handler to provide error handling and redaction. Used during registration.
export const wrapToolHandler = createWrapToolHandler({ redactionPatterns: [/X-API-KEY/i], errorExtractors: [ { match: (error) => error instanceof ConnectorUnavailableError, extract: (error) => ({ kind: "passthrough", text: (error as ConnectorUnavailableError).message, }), }, { match: (error) => error instanceof ConnectorError, extract: (error) => { const e = error as ConnectorError; return { kind: "structured", data: { message: e.message, status: e.status, details: e.body }, }; }, }, { match: (error) => error instanceof UniFiError, extract: (error) => { const e = error as UniFiError; return { kind: "structured", data: { message: e.message, status: e.status, details: e.body }, }; }, }, ], }); - src/index.ts:68-73 (registration)The local `tool()` helper function that registers the tool with the registry and (if enabled) on the MCP server.
function tool(name: string, description: string, schema: any, handler: any): void { registry.register(name, description, currentCategory); if (registry.isEnabled(currentCategory)) { server.tool(name, description, schema, handler); } }