Skip to main content
Glama

Read-only SQL on the warehouse

query_sql
Read-onlyIdempotent
Run a read-only SQL statement against the property warehouse. SELECT and
WITH only; reachable schemas are marts_core, marts_facts, dimensions and
location. Results are capped by `max_rows` (max 5000). Use :name bound
parameters via `params` rather than interpolating values into the string.

This is the last resort. If a curated tool or `query_semantic` can answer
the question, it will be cheaper and faster.
UK only. Costs 125 credits. You are charged if the query reaches the
warehouse and then times out or errors there; a query rejected before
it runs — bad SQL, an unreachable schema, a column that does not
exist — is free, and the error says what to change.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYes
paramsNo
max_rowsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Goes well beyond the readOnly/idempotent hints: it lists allowed statement types, reachable schemas, the row cap, and a precise cost/charging model — including the subtle rule that rejected-before-execution queries are free while timed-out-or-errored ones are charged. That error-vs-timeout distinction is exactly the kind of detail annotations cannot carry.

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, then dialect constraints, then the routing/cost guidance. Dense but nearly every sentence carries distinct information; the cost paragraph is long but justified given the billing subtlety.

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 high-risk, open-ended SQL escape hatch, the description supplies dialect limits, permissible schemas, parameterization guidance, cost, and failure-charging rules. An output schema exists, so return values need not be described.

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 0%, so the description must compensate, and it largely does: it documents `max_rows` (cap 5000), the `params` binding mechanism with a concrete :name syntax example, and why to bind rather than interpolate. It doesn't spell out the default of 1000, but the substantive semantics are covered.

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 (run a read-only SQL statement) and scopes it to the property warehouse. The 'last resort' framing immediately differentiates it from curated siblings like query_semantic and the domain tools.

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?

Explicitly says when NOT to use it ('This is the last resort. If a curated tool or query_semantic can answer the question, it will be cheaper and faster') and names the preferred alternatives. Also adds a geographic constraint ('UK only').

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources