prometheus_list_targets
Retrieve and display all active Prometheus targets for monitoring and analysis, enabling efficient oversight of your infrastructure metrics.
Instructions
List all Prometheus targets
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/prometheus/client.ts:239-246 (handler)Core handler implementation that performs an HTTP GET request to the Prometheus /api/v1/targets endpoint to list all targets, optionally filtered by scrape pool.async listTargets(scrapePool?: string): Promise<TargetsResult> { const endpoint = "/api/v1/targets"; const params: Record<string, string> = {}; if (scrapePool) { params.scrapePool = scrapePool; } return this.request<TargetsResult>(endpoint, params); }
- src/server/tools.ts:132-140 (registration)Tool registration in the tools array, defining metadata, empty input schema, and delegating to PrometheusClient.listTargets() method.defineTool<typeof EmptySchema, TargetsResult>({ capability: "discovery", name: "prometheus_list_targets", title: "List Prometheus Targets", description: "List all Prometheus targets", inputSchema: EmptySchema, type: "readonly", handle: async (client: PrometheusClient) => client.listTargets(), }),
- src/server/tools.ts:76-76 (schema)Zod schema for input validation; empty object schema used by prometheus_list_targets tool.const EmptySchema = z.object({});