prom_targets
Retrieve Prometheus scrape target status to monitor active or dropped metrics collection for system performance analysis.
Instructions
Get scrape target information
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "prom_targets"
}
}Input 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 parameter
async 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 arguments
inputSchema: { type: 'object', properties: { state: { type: 'string', enum: ['active', 'dropped', 'any'] }, }, }, - src/types.ts:28-30 (schema)TypeScript interface PromTargetsArgs matching the input schema
export interface PromTargetsArgs { state?: 'active' | 'dropped' | 'any'; }