prometheus_get_metric_metadata
Retrieve HELP, TYPE, and UNIT metadata from Prometheus to understand metric definitions and write correct PromQL queries.
Instructions
Get metric metadata (HELP text, TYPE, UNIT) from Prometheus.
Wraps GET /api/v1/metadata. Returns the metadata that Prometheus
scraped from HELP, TYPE, and UNIT lines in the exposition
format. Each metric may have multiple metadata entries if different
scrape targets expose different help strings.
Use this to understand what a metric measures, its type (counter, gauge,
histogram, summary), and unit — essential for writing correct PromQL.
For example, knowing a metric is a counter means you should use rate()
or increase(); a gauge can be used directly.
Examples:
- Use when: "What does http_requests_total measure?"
→ metric='http_requests_total'; read help and type.
- Use when: "Show me all histogram metrics"
→ call with no filter; filter results where type='histogram'.
- Use when: Starting an investigation — check metric types before
writing PromQL to avoid using rate() on a gauge.
- Don't use when: You already know the metric type and want to
query values (call prometheus_query directly).
Returns:
dict with metric / total_count / returned_count /
truncated / metadata (dict of metric name → list of
{type, help, unit}).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| metric | No | Optional metric name to filter metadata. Example: 'http_requests_total' returns metadata only for that metric. Leave empty to list metadata for all metrics (capped at 500). | |
| instance | No | Target instance name (omit for default instance) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| metric | Yes | ||
| metadata | Yes | ||
| truncated | Yes | ||
| total_count | Yes | ||
| returned_count | Yes |