Skip to main content
Glama
CubeAPM MCP Server

CubeAPM MCP Server

query_metrics_range

Executes PromQL-compatible range queries against CubeAPM metrics over a specified time range and returns time series data for investigating service latency, errors, and trends.

Instructions

Execute a range query against CubeAPM metrics over a time range. Returns time series data. Uses PromQL-compatible syntax (VictoriaMetrics flavor).

IMPORTANT - CubeAPM Metric Naming Conventions:

  • Metrics use "cube_apm_" prefix (e.g., cube_apm_calls_total, cube_apm_latency_bucket)

  • Service label is "service" (NOT "server" or "service_name")

  • Common labels: env, service, span_kind (server|client|consumer|producer), status_code, http_code

HISTOGRAM QUERIES (P50, P90, P95, P99):

  • CubeAPM uses VictoriaMetrics-style histograms with "vmrange" label (NOT Prometheus "le" buckets)

  • Use histogram_quantiles() function instead of histogram_quantile()

  • Syntax: histogram_quantiles("phi", 0.95, sum by (vmrange, service) (increase(cube_apm_latency_bucket{...}[5m])))

  • Latency values are returned in SECONDS (0.05 = 50ms)

Example range query for P95 over time: histogram_quantiles("phi", 0.95, sum by (vmrange, service) (increase(cube_apm_latency_bucket{service="MyService", span_kind="server"}[5m])))

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "query": "<query>",
      "start": "<start>",
      "end": "<end>",
      "step": "<step>"
    },
    "name": "query_metrics_range"
  }
}

Input Schema

NameRequiredDescriptionDefault
endYesEnd timestamp in RFC3339 format or Unix timestamp
stepYesResolution step width in seconds
queryYesThe metrics query expression (PromQL syntax)
startYesStart timestamp in RFC3339 format or Unix timestamp

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.3.1

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations exist, so the description carries the full disclosure burden. It does add real behavioral context — PromQL/VictoriaMetrics dialect, vmrange rather than le buckets, and that latency values come back in seconds — but says nothing about error behavior, query cost/cardinality limits, or timeouts for long ranges.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the one-line purpose and return type, then sectioned under clear headings (naming conventions, histogram queries, example). The histogram block is long but each element (function name, syntax, units) is load-bearing; only the repeated metric-naming bullets carry slight redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 4-parameter, high-complexity query tool with no output schema and no annotations, the definition covers dialect, label vocabulary, histogram semantics, units, and a runnable example. The remaining gap is practical invocation detail — step selection, time-range limits, and failure modes — rather than core semantics.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3; the description exceeds it by specifying the expression dialect (PromQL-compatible, VictoriaMetrics flavor) and showing a full worked query including label selectors and a 5m increase window. It leaves the step/start/end interaction and alignment unspecified, which keeps it from a 5.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ("Execute a range query against CubeAPM metrics over a time range") and declares the return shape (time series data). It implicitly separates itself from query_metrics_instant via "range" and "over a time range", but never names the instant sibling, so the differentiation is left to inference.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description is rich in domain guidance (naming conventions, vmrange histograms, histogram_quantiles syntax) which tells the agent how to succeed once it has chosen this tool. However, it gives no explicit when-to-use/when-not guidance and never says to prefer query_metrics_instant for point-in-time values, so tool selection is only implied.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.