Skip to main content
Glama
GreptimeDB MCP Server

GreptimeDB MCP Server

Official
by GreptimeTeam

explain_query

Analyze SQL or TQL execution plans to inspect query performance, optionally execute for actual metrics, and reveal verbose per-partition scan and index-pruning statistics.

Instructions

Analyze SQL or TQL query execution plan.

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

Input Schema

NameRequiredDescriptionDefault
queryYesOriginal SQL query or full TQL EVAL (...) <PromQL> statement. Do not include EXPLAIN or ANALYZE wrappers.
analyzeNoExecute and show actual metrics
verboseNoShow detailed per-partition scan metrics; combine with analyze=true to reveal index-pruning counters (rg_bloom_filtered, rg_inverted_filtered, rg_minmax_filtered, rows_bloom_filtered, rows_inverted_filtered)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv0.6.2
    • addedInput schema / properties / analyze / description
      Added value: +"Execute and show actual metrics"
    • addedInput schema / properties / query / description
      Added value: +"Original SQL query or full TQL EVAL (...) <PromQL> statement. Do not include EXPLAIN or ANALYZE wrappers."
    • addedInput schema / properties / verbose / description
      Added value: +"Show detailed per-partition scan metrics; combine with analyze=true to reveal index-pruning counters (rg_bloom_filtered, rg_inverted_filtered, rg_minmax_filtered, rows_bloom_filtered, rows_inverted_filtered)"
    • changedOutput schema / (root)
      Previous value: -{
      -  "properties": {
      -    "result": {
      -      "title": "Result",
      -      "type": "string"
      -    }
      -  },
      -  "required": [
      -    "result"
      -  ],
      -  "title": "explain_queryOutput",
      -  "type": "object"
      -}New value: +null
  2. Changed1 schema field changedv0.5.1
    • addedInput schema / properties / verbose
      Added value: +{
      +  "default": false,
      +  "title": "Verbose",
      +  "type": "boolean"
      +}
  3. Addedv0.5.0

TDQS

C2.9/5.0
Behavior2/5

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

No annotations are supplied, so the description carries the full behavioral burden, yet it never states that analyze=true actually executes the query and may incur real cost or side effects. It also says nothing about output shape, latency, or whether the query is rewritten/limited.

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?

A single front-loaded sentence with no filler or redundancy. It is efficient, though its brevity borders on under-specification rather than pure conciseness.

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

Completeness2/5

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

For a 3-parameter tool with no annotations and no output schema, the description omits the key operational fact that analyze mode executes the query, and gives no hint about what the returned plan contains. An agent must fall back entirely on the parameter schema to call it safely.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents query, analyze (executes and shows actual metrics), and verbose (per-partition counters). The description adds no meaning beyond that, which is the expected baseline when the schema does the heavy lifting.

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 ('Analyze') and resource ('SQL or TQL query execution plan'), so an agent can tell it produces a plan rather than results. It does not name a sibling, but the verb/resource pair still separates it reasonably well from execute_sql/execute_tql.

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

Usage Guidelines2/5

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

There is no when-to-use or when-not-to-use guidance: nothing says to prefer this over execute_sql/execute_tql when inspecting a plan, nor when dryrun_pipeline would be the better alternative. Usage is only inferable from the tool name.

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