Skip to main content
Glama
GreptimeDB MCP Server

GreptimeDB MCP Server

Official
by GreptimeTeam

execute_tql

Run PromQL-compatible TQL queries for time-series metric analysis; results are row- and byte-bounded with truncation notices.

Instructions

Execute TQL query for time-series analysis. TQL is PromQL-compatible.

Use it for metric tables, where the table name is the metric name and the
value columns are the PromQL fields. PromQL vector matching can combine
metrics from different tables. Use execute_sql for log or event rows,
trace analysis, and SQL JOINs.

`metric{__schema__="other_db"}` reads a database other than the connected
one. That matcher accepts `=` only.

Returns at most 10000 rows, also bounded by a byte budget. JSON reports
`truncated`; CSV and Markdown append a truncation notice. A shorter time
range or fewer series changes coverage; a larger step lowers resolution.
An untruncated retry with those changes does not cover the original query.

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": "execute_tql"
  }
}

Input Schema

NameRequiredDescriptionDefault
endYesEnd time: SQL expression (e.g., 'now()'), RFC3339, or Unix timestamp
stepYesQuery resolution step, e.g., '1m', '5m', '1h'
queryYesPromQL-compatible expression. Supports standard PromQL syntax: rate(), increase(), sum(), avg(), histogram_quantile(), etc. Example: rate(http_requests_total[5m])
startYesStart time: SQL expression (e.g., "now() - interval '5' minute"), RFC3339 (e.g., '2024-01-01T00:00:00Z'), or Unix timestamp
formatNoOutput format: csv, json, or markdown (default: json)json
lookbackNoLookback delta: how far back a sample may be reused when a step lands where there is no sample, e.g. '5m'. Defaults to 5m.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed7 schema fields changedv0.6.2
    • addedInput schema / properties / end / description
      Added value: +"End time: SQL expression (e.g., 'now()'), RFC3339, or Unix timestamp"
    • addedInput schema / properties / format / description
      Added value: +"Output format: csv, json, or markdown (default: json)"
    • addedInput schema / properties / lookback / description
      Added value: +"Lookback delta: how far back a sample may be reused when a step lands where there is no sample, e.g. '5m'. Defaults to 5m."
    • addedInput schema / properties / query / description
      Added value: +"PromQL-compatible expression. Supports standard PromQL syntax: rate(), increase(), sum(), avg(), histogram_quantile(), etc. Example: rate(http_requests_total[5m])"
    • addedInput schema / properties / start / description
      Added value: +"Start time: SQL expression (e.g., \"now() - interval '5' minute\"), RFC3339 (e.g., '2024-01-01T00:00:00Z'), or Unix timestamp"
    • addedInput schema / properties / step / description
      Added value: +"Query resolution step, e.g., '1m', '5m', '1h'"
    • changedOutput schema / (root)
      Previous value: -{
      -  "properties": {
      -    "result": {
      -      "title": "Result",
      -      "type": "string"
      -    }
      -  },
      -  "required": [
      -    "result"
      -  ],
      -  "title": "execute_tqlOutput",
      -  "type": "object"
      -}New value: +null
  2. Addedv0.5.0

TDQS

A4.5/5.0
Behavior4/5

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

With no annotations, the description carries the burden and does so well: it discloses the 10000-row limit plus byte budget, how truncation surfaces per format (JSON `truncated` field, CSV/Markdown notices), and the coverage-vs-resolution tradeoff including that a narrowed retry does not cover the original query. It omits permission/auth requirements, so not quite a 5.

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 purpose then alternative routing, followed by schema escaping, limits, and truncation behavior. Sentences are dense but each conveys actionable information; the closing paragraph is slightly verbose but earns its place.

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?

No output schema and no annotations, yet the description covers purpose, alternatives, row/byte limits, truncation reporting, and resolution tradeoffs for a 6-param query tool. Return-shape detail is limited to truncation behavior but is sufficient for correct invocation.

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, but the description adds real meaning: `metric{__schema__="other_db"}` reads another database and that matcher accepts `=` only, and a larger step lowers resolution. These are non-obvious semantics beyond the schema's field descriptions.

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 and resource (Execute TQL query) plus scope (time-series analysis) and clarifies TQL is PromQL-compatible. It explicitly distinguishes itself from execute_sql, so an agent can select between them without opening either 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?

Gives explicit when-to-use ('metric tables, where table name is the metric name') and when-not-to-use ('Use execute_sql for log or event rows, trace analysis, and SQL JOINs'), naming the sibling alternative directly. It also notes PromQL vector matching can combine metrics across tables.

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