Skip to main content
Glama
influxdata

InfluxDB MCP Server

Official
by influxdata

query_sql

Run a bounded, read-only SQL query against an InfluxDB 3 database and return structured rows, warnings, row counts, and query metadata.

Instructions

Run one bounded, read-only SQL query against an InfluxDB 3 database. Accepts database as an alias for db and query as an alias for q; differing pairs are rejected. Defaults to JSON output and returns structured rows, warnings, and query metadata. Core and Enterprise also return jsonl or csv; Cloud Dedicated, Cloud Serverless, and Clustered return only JSON. Your answer must report metadata.completeness, the cap when capped, warnings, and row_count; see READING QUERY RESULTS in get_help. In SQL, quoted identifiers are exact column names; if a quoted selector contains *, treat it as wildcard intent, call describe_table, expand matching fields explicitly, then retry one bounded query_sql. Use query_influxql regex only when the user explicitly asks for InfluxQL or regex field selection.

Input Schema

NameRequiredDescriptionDefault
qNoRead-only SQL query to run. Provide q or query; if both are present, they must agree.
dbNoDatabase name to query. Provide db or database; if both are present, they must agree.
queryNoAlias for q; provide one or equal values.
formatNoOutput format for query results. Core and Enterprise return json, jsonl, or csv; Cloud Dedicated, Cloud Serverless, and Clustered return json. Other formats are refused with unsupported_query_format.json
paramsNoOptional query parameters to pass through
maxRowsNoMaximum rows to return. Default 1000; hard max 5000.
databaseNoAlias for db; provide one or equal values.
timeoutMsNoOptional query timeout in milliseconds

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed9 schema fields changedv2.0.0
    • addedInput schema / properties / database
      Added value: +{
      +  "description": "Alias for db; provide one or equal values.",
      +  "type": "string"
      +}
    • changedInput schema / properties / db / description
      Previous value: -"Database name to query"New value: +"Database name to query. Provide db or database; if both are present, they must agree."
    • changedInput schema / properties / format / description
      Previous value: -"Output format for query results"New value: +"Output format for query results. Core and Enterprise return json, jsonl, or csv; Cloud Dedicated, Cloud Serverless, and Clustered return json. Other formats are refused with unsupported_query_format."
    • changedInput schema / properties / maxRows / type
      Previous value: -"number"New value: +"integer"
    • addedInput schema / properties / params / anyOf
      Added value: +[
      +  {
      +    "type": "object"
      +  },
      +  {
      +    "type": "array"
      +  }
      +]
    • changedInput schema / properties / q / description
      Previous value: -"Read-only SQL query to run"New value: +"Read-only SQL query to run. Provide q or query; if both are present, they must agree."
    • addedInput schema / properties / query
      Added value: +{
      +  "description": "Alias for q; provide one or equal values.",
      +  "type": "string"
      +}
    • changedInput schema / properties / timeoutMs / type
      Previous value: -"number"New value: +"integer"
    • changedInput schema / required
      Previous value: -[
      -  "db",
      -  "q"
      -]New value: +[]
  2. First observedv1.4.1-test.1

TDQS

A4.8/5.0
Behavior5/5

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

No annotations are present, so the description carries the full burden and does: read-only, single/bounded execution, JSON default, per-deployment format support, and the required reporting contract (metadata.completeness, cap, warnings, row_count). It also discloses that conflicting alias pairs are rejected.

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 and constraint, and every sentence carries operational information. The middle section is dense and long-sentenced, but none of it is filler.

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

Completeness5/5

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

For a complex, no-output-schema query tool, the description covers return shape (structured rows, warnings, query metadata), format availability, alias handling, and a recovery path, plus a pointer to get_help for result interpretation. Nothing an agent needs to invoke it correctly is missing.

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 adds semantics the schema lacks, notably that db/database and q/query alias pairs must agree or be rejected, and that non-JSON formats are refused on Cloud/Clustered deployments. It does not restate maxRows fallback or timeout behavior beyond the schema.

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 first sentence states a specific verb, resource, and constraint set: "Run one bounded, read-only SQL query against an InfluxDB 3 database." It also separates itself from the sibling query_influxql by naming that tool and its distinct use case.

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?

Explicit routing: use query_influxql "only when the user explicitly asks for InfluxQL or regex field selection." It also gives a concrete fallback workflow (call describe_table, expand fields, retry one bounded query) for wildcard-in-quoted-selector cases.

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