Skip to main content
Glama
pab1it0

Prometheus MCP Server

get_targets

Retrieve scrape target information from Prometheus monitoring to identify active endpoints and their status for metric collection.

Instructions

Get information about all scrape targets

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registration of the 'get_targets' tool using FastMCP's @mcp.tool decorator. Defines the tool's description, title, icon, and operational hints.
    description="Get information about all scrape targets", annotations={ "title": "Get Scrape Targets", "icon": "🎯", "readOnlyHint": True, "destructiveHint": False, "idempotentHint": True, "openWorldHint": True } )
  • The handler function for the 'get_targets' tool. Makes a request to Prometheus API '/api/v1/targets' 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

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