prometheus_query
Execute an instant PromQL query to get current metric values from Prometheus. Returns labels, timestamp, and value for time series at a single point in time.
Instructions
Execute an instant PromQL query against Prometheus.
Wraps GET /api/v1/query. Returns the result type (vector, scalar,
matrix, string) and a list of samples each carrying labels, timestamp,
and value. For vector results each element is one time series at the
evaluation instant.
Examples:
- Use when: "Is the payment service up right now?"
→ query='up{job="payment-service"}'.
- Use when: "What is the current HTTP request rate?"
→ query='sum(rate(http_requests_total[5m])) by (job)'.
- Use when: "Show me all metrics for a specific instance"
→ query='{instance="localhost:9090"}'.
- Don't use when: You want to see how a metric changed over time
(call prometheus_query_range with start/end/step).
- Don't use when: You don't know the metric name yet
(call prometheus_list_metrics first to discover names).
Returns:
dict with query / time / result_type / result_count /
data (list of samples with labels, timestamp, value).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | PromQL expression to evaluate. Examples: 'up', 'rate(http_requests_total[5m])', 'sum(rate(http_requests_total[5m])) by (job)'. | |
| time | No | Evaluation timestamp (optional). RFC3339 (e.g. '2024-01-15T10:00:00Z') or Unix timestamp (e.g. '1705312800'). Defaults to now. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| time | Yes | ||
| result_type | Yes | ||
| result_count | Yes | ||
| data | Yes |