Skip to main content
Glama
pab1it0

Prometheus MCP Server

get_targets

Retrieve detailed information about all scrape targets in Prometheus to monitor and analyze metrics effectively using standardized MCP interfaces.

Instructions

Get information about all scrape targets

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The async handler function that implements the get_targets tool. It calls the Prometheus /api/v1/targets endpoint via make_prometheus_request and returns a dictionary containing activeTargets and droppedTargets lists.
    async def get_targets() -> Dict[str, List[Dict[str, Any]]]: """Get information about all Prometheus scrape targets. Returns: Dictionary with active and dropped targets information """ logger.info("Retrieving scrape targets information") data = make_prometheus_request("targets") result = { "activeTargets": data["activeTargets"], "droppedTargets": data["droppedTargets"] } logger.info("Scrape targets retrieved", active_targets=len(data["activeTargets"]), dropped_targets=len(data["droppedTargets"])) return result
  • The @mcp.tool decorator that registers the get_targets function as an MCP tool, providing its description and annotations.
    @mcp.tool( description="Get information about all scrape targets", annotations={ "title": "Get Scrape Targets", "icon": "🎯", "readOnlyHint": True, "destructiveHint": False, "idempotentHint": True, "openWorldHint": True } )

Other Tools

Related Tools

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

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