Skip to main content
Glama

run_query

Execute arbitrary read-only SQL to retrieve up to 1000 rows of telemetry data, including TimescaleDB functions, with a 30-second timeout, for queries not covered by other tools.

Instructions

Run arbitrary read-only SQL and return rows INLINE, capped at 1000.

The escape hatch for questions the other tools do not cover. Runs in a Postgres READ ONLY transaction with a 30 s statement timeout. TimescaleDB functions like time_bucket are available. Remember the camelCase columns need double quotes.

If you are collecting data to plot, use export_query instead -- this tool spends context on every row it returns.

Name any topic you filtered on in your answer to the user.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
carNo
sqlYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior5/5

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

With no annotations provided, the description carries full responsibility for behavioral disclosure. It states the operation is read-only, runs in a Postgres READ ONLY transaction with a 30s timeout, returns a maximum of 1000 rows, and requires double-quoting camelCase columns. It also notes that every row consumes context, which is a critical cost warning. This is thorough and transparent.

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?

The description is appropriately sized and front-loaded with purpose and key constraints. It includes a necessary warning about context usage and a usage directive, all in a compact format. While slightly long, every sentence serves a function; it could be trimmed but remains efficient.

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

Completeness3/5

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

For an arbitrary SQL tool with an output schema, the description covers the main behavioral aspects: read-only, timeout, row cap, quoting, and context cost. However, it omits any explanation of the 'car' parameter and does not describe the exact return format or error behavior beyond the cap. Given the complexity of arbitrary SQL, this leaves some gaps, but the core essentials are present.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must explain parameters. It implies the 'sql' parameter is the SQL query but does not name it or describe its format. The 'car' parameter is completely unmentioned, leaving the agent to guess its purpose. The description adds little beyond what the schema type hints suggest, and fails to compensate for the lack of schema documentation.

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 description clearly states the tool runs arbitrary read-only SQL and returns rows inline, capped at 1000. It explicitly labels itself as 'the escape hatch for questions the other tools do not cover', which distinguishes it from siblings like export_query and get_series. The verb 'run' and resource 'SQL' are specific and unambiguous.

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 description gives explicit guidance on when not to use it: 'If you are collecting data to plot, use export_query instead – this tool spends context on every row it returns.' It also frames itself as the fallback for uncovered questions, and instructs the agent to name any topic filtered on in the answer. This clearly routes the agent to alternatives and provides actionable usage context.

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