Skip to main content
Glama

Read-only SQL over the public dataset

run_sql
Read-only

One SELECT (or WITH) over the public data-layer tables. Enforced in the database, not the worker: a read-only transaction as a role that can see only those tables, a statement timeout set by the TIER, and a hard 300-row cap. No semicolons, no comments, no multi-statement.

Priced by the time it takes: one Query Unit per started 5 seconds, floor of 1 — so a query that answers quickly costs 1, which is what every query cost before this was metered. tier buys the ceiling (standard 15s, extended 60s and a paid plan); the tier maximum is HELD when the call starts and the unused part released the moment the duration is known, so usage.units_charged on the response is the settled figure. Call get_account for the tier table, or send explain_only to be quoted without running or paying for anything.

Wraps POST /v0/sql. Access: an organization API key on any plan, metered against that organization’s Query Unit balance at 1 unit per started 5 seconds of query time. A paid plan buys the longer 60-second tier, not the route. A trial key belongs to no organization and is refused with the x402 price of one query instead of being served.

Returns:

  • rows: Result rows.

  • row_count: Number of rows returned.

  • duration_ms: Server-side execution time. This is what the call is priced on.

  • authenticated: Whether a key was accepted.

  • tier: The CREDENTIAL: anonymous, trial, or an organization tier.

  • sql_tier: The QUERY: which ceiling this run was given and priced at. A separate field from tier, which has always meant the credential.

  • quote: What the query was quoted at before it ran: the tier's ceiling and price bounds, plus the planner's own planner_cost and plan_rows. The planner figures are ADVISORY — arbitrary units, uncalibrated against this schema — and never charge anything; settlement is from measured duration, which needs no calibration to be right.

  • usage: What this call cost and what is left. units_charged is SETTLED, not the hold: the tier maximum is taken up front and the unused part released once the duration is known.

Input Schema

NameRequiredDescriptionDefault
sqlYesA single read-only SELECT (or WITH) statement over the public dataset. No semicolons, no comments, no platform internals. Row cap 300.
limitNoRows to return. Clamped to 300.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.7/5.0
Behavior4/5

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

Annotations already declare readOnlyHint/destructiveHint/openWorld, but the description adds substantial value beyond them: DB-enforced read-only role, tier-based statement timeout, hard 300-row cap, per-5-second Query Unit pricing, and the exact auth failure mode ('a trial key belongs to no organization and is refused'). The only blemish is describing a `tier` selector and `explain_only` flag that the schema does not expose.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The core constraint is correctly front-loaded in the first sentence, but the body is long and repeats itself — the per-5-second pricing and the hold-then-settle mechanic are explained in the pricing paragraph, again in the Access paragraph, and a third time under `usage.units_charged`. Roughly a third of the text could be cut without losing information.

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?

With no output schema, documenting the return fields (rows, row_count, duration_ms, quote, usage) is genuinely necessary and done well, including the warning that planner_cost is advisory and uncalibrated. Auth requirements, row cap and timeouts are all covered; only the phantom `tier`/`explain_only` references keep it from being fully trustworthy.

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 coverage is 100% for the two real parameters, so the baseline would be 3, but the description actively introduces semantics for parameters that do not exist ('`tier` buys the ceiling (standard 15s, extended 60s)' and 'send `explain_only`'). An agent reading this would construct calls that fail validation, which is worse than adding nothing.

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 ('One SELECT (or WITH) over the public data-layer tables') plus the enforcement model, which immediately separates it from the list_*/get_* siblings that return canned collections. An agent can tell this is the ad-hoc query escape hatch without opening the schema.

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

Usage Guidelines3/5

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

It gives real routing advice — 'Call get_account for the tier table' — and frames the cost model so an agent can judge whether a query is worth running. But it also directs the agent to 'send `explain_only`' and says '`tier` buys the ceiling', and neither is a parameter in the schema (additionalProperties: false), so the guidance points at options that will be rejected. That undercuts otherwise strong when-to-use context.

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