Skip to main content
Glama

prometheus_scrape_pool_targets

Retrieve targets for a specific scrape pool in Prometheus, enabling precise monitoring and analysis of selected metrics for effective infrastructure management.

Instructions

Get targets for a specific scrape pool

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scrapePoolYesscrape pool name

Implementation Reference

  • Tool handler lambda that executes the core logic by calling PrometheusClient.getScrapePoolTargets with the provided scrapePool argument.
    handle: async (client: PrometheusClient, args) => client.getScrapePoolTargets(args.scrapePool),
  • Zod input schema for the tool, defining the required 'scrapePool' parameter.
    const PrometheusScrapePoolTargetsSchema = z.object({ scrapePool: z.string().describe("scrape pool name"), });
  • Definition and registration of the tool in the tools array, including name, metadata, schema, and handler.
    defineTool<typeof PrometheusScrapePoolTargetsSchema, TargetsResult>({ capability: "discovery", name: "prometheus_scrape_pool_targets", title: "Get Scrape Pool Targets", description: "Get targets for a specific scrape pool", inputSchema: PrometheusScrapePoolTargetsSchema, type: "readonly", handle: async (client: PrometheusClient, args) => client.getScrapePoolTargets(args.scrapePool), }),
  • PrometheusClient method directly invoked by the tool handler, forwarding to listTargets.
    async getScrapePoolTargets(scrapePool: string): Promise<TargetsResult> { return this.listTargets(scrapePool); }
  • Core helper method that performs the HTTP request to Prometheus /api/v1/targets endpoint with optional scrapePool query parameter, returning TargetsResult.
    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); }

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/idanfishman/prometheus-mcp'

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