query-isp-metrics
Retrieve ISP performance metrics filtered by host, site, time duration, and metric type to monitor latency, uptime, downtime, and speed.
Instructions
Query ISP metrics with filters. May be unavailable depending on account
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hostIds | No | Filter by host IDs | |
| siteIds | No | Filter by site IDs | |
| duration | No | Time duration (e.g., '1h', '24h', '7d') | |
| metricType | No | Type of ISP metric to query |
Implementation Reference
- src/tools/isp-metrics.ts:23-36 (handler)The main handler function for query-isp-metrics. Accepts optional filters (hostIds, siteIds, duration, metricType) and POSTs to /isp-metrics/query endpoint. Returns data on success or a fallback message on error.
export async function queryIspMetrics(params: z.infer<typeof queryIspMetricsSchema>) { try { const body: Record<string, unknown> = {}; if (params.hostIds) body.hostIds = params.hostIds; if (params.siteIds) body.siteIds = params.siteIds; if (params.duration) body.duration = params.duration; if (params.metricType) body.metricType = params.metricType; const response = await unifiClient.post<{ data: unknown }>("/isp-metrics/query", body); return response.data; } catch { return { available: false, message: "ISP metrics query endpoint not available for this account" }; } } - src/tools/isp-metrics.ts:15-21 (schema)Zod schema defining input parameters: hostIds (optional string array), siteIds (optional string array), duration (optional string), metricType (optional enum: latency, downtime, uptime, speed).
export const queryIspMetricsSchema = z.object({ hostIds: z.array(z.string()).optional().describe("Filter by host IDs"), siteIds: z.array(z.string()).optional().describe("Filter by site IDs"), duration: z.string().optional().describe("Time duration (e.g., '1h', '24h', '7d')"), metricType: z.enum(["latency", "downtime", "uptime", "speed"]).optional() .describe("Type of ISP metric to query"), }); - src/index.ts:129-131 (registration)Registration of the tool with name 'query-isp-metrics', description, schema, and handler wrapped via wrapToolHandler.
tool("query-isp-metrics", "Query ISP metrics with filters. May be unavailable depending on account", queryIspMetricsSchema.shape, wrapToolHandler(queryIspMetrics)); - src/tools/isp-metrics.ts:1-2 (helper)Imports: zod for validation and unifiClient for API calls.
import { z } from "zod/v4"; import { unifiClient } from "../client.js";