Skip to main content
Glama
CubeAPM MCP Server

CubeAPM MCP Server

query_metrics_instant

Run an instant PromQL-compatible query against CubeAPM metrics to evaluate latency, error rates, or service counts at a single timestamp.

Instructions

Execute an instant query against CubeAPM metrics at a single point in time. 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) (increase(cube_apm_latency_bucket{...}[5m])))

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

Example queries:

  • P95 latency: histogram_quantiles("phi", 0.95, sum by (vmrange, service) (increase(cube_apm_latency_bucket{service="MyService", span_kind="server"}[5m])))

  • Error rate: sum by (service) (increase(cube_apm_calls_total{status_code="ERROR"}[1h])) / sum by (service) (increase(cube_apm_calls_total[1h])) * 100

  • List services: count by (service) (cube_apm_calls_total{env="UNSET"})

  • Request count: sum by (service) (increase(cube_apm_calls_total{span_kind=~"server|consumer"}[1h]))

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>",
      "time": "<time>"
    },
    "name": "query_metrics_instant"
  }
}

Input Schema

NameRequiredDescriptionDefault
stepNoTime window in seconds for processing data
timeYesEvaluation timestamp in RFC3339 format or Unix timestamp in seconds
queryYesThe metrics query expression (PromQL syntax)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.3.1

TDQS

A4.1/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 burden. It usefully discloses the query dialect (VictoriaMetrics-flavored PromQL), that latencies are returned in SECONDS, and that histograms use vmrange rather than le buckets. It says nothing about authentication, rate limits, timeout behavior, default step handling, or what an empty/failed response looks like.

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 core action, then organized into labeled sections (naming conventions, histogram queries, examples) that are easy to scan. It is long, but nearly every line carries non-obvious domain knowledge; the examples are the bulkiest part yet also the most actionable.

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?

With no output schema and no annotations, the description supplies the domain knowledge an agent needs to form a correct query: metric prefix, label vocabulary, histogram function substitution, and value units. Missing pieces are the semantics of 'step' and 'time' defaults and the response shape, which leave a small but real gap.

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 baseline is 3. The description goes well beyond the terse schema text by explaining the exact query syntax expected, the metric prefix, and required label names, which materially reduces invalid-query mistakes. It adds nothing about the 'step' or 'time' parameters beyond what the schema already says.

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

Purpose5/5

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

States a specific verb+resource+scope: 'Execute an instant query against CubeAPM metrics at a single point in time.' The 'single point in time' framing implicitly separates it from the range-query sibling, so an agent can pick correctly without inspecting schemas.

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

Usage Guidelines4/5

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

Gives concrete usage context through worked example queries (P95, error rate, service listing, request count) and the CubeAPM naming conventions needed to write a valid query. It does not explicitly say when to prefer this over query_metrics_range or what to do on empty results, so it stops short of full routing guidance.

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