Skip to main content
Glama
WhaTap MCP Server

WhaTap MCP Server

Official
by whatap

whatap_create_promql

Create and validate reusable PromQL queries against live OpenMetrics data; valid queries are saved for reuse via whatap_data_availability, while invalid ones return errors for correction.

Instructions

Create and validate a reusable PromQL query for OpenMetrics data. The query is validated by executing it against live data. If valid, the query is saved and appears in whatap_data_availability for future reuse. If invalid, returns the error so you can fix the query.

WORKFLOW:

  1. whatap_data_availability(projectCode) → discover OpenMetrics + suggested queries

  2. whatap_create_promql(projectCode, name, query) → compose PromQL, validate, save

  3. whatap_query_data(projectCode, savedQuery=name) → reuse anytime

Compose your query from metrics discovered in step 1:

  • Counter metrics: rate(metric_name[5m])

  • Gauge metrics: metric_name

  • Histogram: histogram_quantile(0.95, rate(metric_bucket[5m]))

  • Aggregate: sum by (label)(expression)

Example: whatap_create_promql(projectCode=3730, name="CPU by Pod", query="sum by (pod)(rate(container_cpu_usage_seconds_total[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": {
      "projectCode": "<projectCode>",
      "name": "<name>",
      "query": "<query>"
    },
    "name": "whatap_create_promql"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameYesA descriptive name for the query (e.g., "CPU Usage per Instance", "Memory by Pod"). Used as the key for reuse.
queryYesPromQL expression to validate and save (e.g., "rate(node_cpu_seconds_total[5m])", "sum by (pod)(container_memory_usage_bytes)").
timeRangeNoTime range (default: "5m"). Examples: "5m", "1h", "6h", "1d", "last 30 minutes".5m
descriptionNoWhat this query measures. Helps LLMs understand the query purpose.
projectCodeYesProject code (pcode). Get this by calling whatap_list_projects first — it returns all accessible projects with their pcodes.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.5.3

TDQS

A4.5/5.0
Behavior4/5

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

With no annotations provided, the description carries the full burden and does well: it discloses the side effect (a validated query is persisted and appears in whatap_data_availability) and the failure path (the error is returned so the caller can fix the query). Gaps remain on name-collision behavior (overwrite vs. error on a duplicate name) and whether timeRange governs validation only or the saved query's evaluation window.

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 purpose sentence, then a numbered workflow, then a compact bullet list of query patterns and one concrete example — each block earns its place. It runs slightly long with the four-pattern list duplicating general PromQL knowledge, but nothing is redundant filler.

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 five-parameter tool that persists a named resource with no annotations and no output schema, the description covers purpose, sequencing, validation behavior, save semantics, and error handling. Only the overwrite/idempotency question and the exact scope of timeRange are left unspecified.

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 goes beyond it by supplying PromQL construction patterns tied to metric types (counter → rate(), gauge → bare name, histogram → histogram_quantile, aggregation via sum by), which is real semantic guidance the schema does not encode. Its worked example also demonstrates how name, query, and projectCode combine. The timeRange parameter is never explained 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?

The opening sentence names a specific verb and resource — 'Create and validate a reusable PromQL query for OpenMetrics data' — and immediately scopes it against siblings by naming whatap_data_availability (discovery) and whatap_query_data (reuse). An agent can distinguish this tool's role without opening any schema.

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

Usage Guidelines5/5

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

The WORKFLOW block gives an explicit ordered when-to-use: call whatap_data_availability first to discover metrics, then this tool to compose/validate/save, then whatap_query_data to reuse. It also states the precondition ('Compose your query from metrics discovered in step 1'), which is exactly the routing guidance an agent needs.

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