prom_targets
Retrieve Prometheus scrape target status to monitor active or dropped metrics collection for system performance analysis.
Instructions
Get scrape target information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| state | No |
Implementation Reference
- src/tools.ts:121-128 (handler)Handler logic for 'prom_targets' tool in handleToolCall: validates arguments and delegates to prometheusClient.targets(state)case 'prom_targets': { if (!isPromTargetsArgs(args)) { throw new Error('Invalid arguments for prom_targets'); } const { state } = args as PromTargetsArgs; result = await prometheusClient.targets(state); break; }
- src/prometheus-client.ts:109-114 (helper)Core implementation in PrometheusClient.targets(): makes HTTP GET to Prometheus /api/v1/targets endpoint with optional state parameterasync targets(state?: 'active' | 'dropped' | 'any'): Promise<PrometheusResponse<TargetsResult>> { const params: Record<string, string> = {}; if (state) params.state = state; const response = await this.client.get<PrometheusResponse<TargetsResult>>('/api/v1/targets', { params }); return response.data; }
- src/tools.ts:54-64 (registration)Registration of 'prom_targets' tool in the tools array, including name, description, and inputSchema{ name: 'prom_targets', description: 'Get scrape target information', inputSchema: { type: 'object', properties: { state: { type: 'string', enum: ['active', 'dropped', 'any'] }, }, }, }, ];
- src/tools.ts:57-62 (schema)Input schema definition for 'prom_targets' tool argumentsinputSchema: { type: 'object', properties: { state: { type: 'string', enum: ['active', 'dropped', 'any'] }, }, },
- src/types.ts:28-30 (schema)TypeScript interface PromTargetsArgs matching the input schemaexport interface PromTargetsArgs { state?: 'active' | 'dropped' | 'any'; }