Skip to main content
Glama

run_sql

Executes one validated, read-only SELECT against visible catalog models when no metric fits, enforcing PII permissions and capped results.

Instructions

Run one read-only SELECT against catalog models when no metric fits.

The query is validated before it runs: only visible catalog models, no PII columns without pii:read, no file or system functions, and results are capped.

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": {
      "sql": "<sql>"
    },
    "name": "run_sql"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlYesOne read-only DuckDB SELECT over catalog models.

Output Schema

NameRequiredDescriptionDefault
sqlYes
rowsYes
modelsYes
columnsYes
query_idYes
warningsNo
row_countYes
truncatedYes
elapsed_msYes
catalog_versionYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.1

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations supplied, the description carries the whole burden, and it does substantial work: it declares the operation read-only, discloses a pre-execution validation gate, names the permission requirement (pii:read) for sensitive columns, forbids file and system functions, and warns that results are capped. It stops short of stating whether validation failures return an error or an empty result, and gives no number for the cap, so the agent can't anticipate truncation precisely.

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

Conciseness5/5

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

Two sentences, both front-loaded with the highest-value information: what it is and its exclusivity condition first, then the guardrails. Nothing is repeated from the schema word-for-word and no sentence is filler.

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?

An output schema exists, so return-value description is rightly omitted, and the guardrail paragraph covers the safety and permission surface an agent needs before writing SQL. The remaining gap is operational detail: the size of the result cap and failure behavior on validation rejection, both of which affect how an agent should compose and retry queries.

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

Parameters3/5

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

Schema coverage is 100% and the schema already says "One read-only DuckDB SELECT over catalog models," so the parameter is fully documented structurally. The description's added signal is the "one" single-statement limit and the implicit DuckDB/i>dialect expectation, which is marginal beyond what the schema states; baseline 3 fits.

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?

"Run one read-only SELECT against catalog models" gives a specific verb (run), a specific input resource (a SQL SELECT), and a scope constraint (exactly one statement, read-only). The trailing clause "when no metric fits" separates it from the metric-oriented siblings such as query_metric and list_metrics without needing their schemas.

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

Usage Guidelines4/5

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

The phrase "when no metric fits" is an explicit routing condition that tells the agent to prefer metric tools first and fall back here only when nothing precomputed matches. What's missing is a negative boundary: it never says when this tool is the wrong choice (e.g. trivial lookups better served by describe_model or search_models).

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