Skip to main content
Glama
pab1it0

Prometheus MCP Server

get_metric_metadata

Retrieve detailed metadata for a specific metric using the Prometheus MCP Server, enabling precise analysis and understanding of metric attributes for effective monitoring.

Instructions

Get metadata for a specific metric

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
metricYes

Implementation Reference

  • Registration of the get_metric_metadata tool using the @mcp.tool decorator with description and annotations.
    @mcp.tool( description="Get metadata for a specific metric", annotations={ "title": "Get Metric Metadata", "icon": "ℹ️", "readOnlyHint": True, "destructiveHint": False, "idempotentHint": True, "openWorldHint": True } )
  • The main handler function for the get_metric_metadata tool. It constructs the Prometheus metadata endpoint URL, makes the API request using make_prometheus_request, handles different response structures ('metadata' or 'data' keys), converts dict to list if necessary, and returns the metadata.
    async def get_metric_metadata(metric: str) -> List[Dict[str, Any]]: """Get metadata about a specific metric. Args: metric: The name of the metric to retrieve metadata for Returns: List of metadata entries for the metric """ logger.info("Retrieving metric metadata", metric=metric) endpoint = f"metadata?metric={metric}" data = make_prometheus_request(endpoint, params=None) if "metadata" in data: metadata = data["metadata"] elif "data" in data: metadata = data["data"] else: metadata = data if isinstance(metadata, dict): metadata = [metadata] logger.info("Metric metadata retrieved", metric=metric, metadata_count=len(metadata)) return metadata

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