Skip to main content
Glama
yanmxa

Prometheus MCP Server

by yanmxa

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
NameRequiredDescriptionDefault
stateNo

Implementation Reference

  • 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;
    }
  • 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'] },
          },
        },
      },
    ];
  • Input schema definition for 'prom_targets' tool arguments
    inputSchema: {
      type: 'object',
      properties: {
        state: { type: 'string', enum: ['active', 'dropped', 'any'] },
      },
    },
  • TypeScript interface PromTargetsArgs matching the input schema
    export interface PromTargetsArgs {
      state?: 'active' | 'dropped' | 'any';
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yanmxa/prometheus-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server