Skip to main content
Glama

Run SQL over the dataset

query_dataset
Read-onlyIdempotent

Run read-only DuckDB SELECTs over the dataset behind the other tools, for a question none of them asks. Call describe_dataset first; it lists the 44 views, their columns, joins and recipes. Prefer a typed tool when one fits.

  • statements=[…]: up to 5 statements in one call, one result or error each.

  • Result: columns, and rows as arrays, up to max_rows (≤ 500, default 100) and 16 KB. When truncated is true: aggregate, filter, or use LIMIT and OFFSET. One SELECT (or SHOW, DESCRIBE, FROM-first), no semicolon, 15 s limit, nothing outside the bundle.

  • Dev-branch isolation: JOIN contrib_branch and filter kind = 'dev_branch' AND project <> 'drupal' before counting projects. change_record_adoption, symbol_usage and core_symbol_evidence hold release tags too. core_symbol_evidence is the full rollup; symbol_usage is its string-scan subset.

  • Adoption polarity: legacy is still on the old API (not adopted); migrated is adopted. Versions are text: compare _seq integers (major1000+minor). Never SUM(usage) across branch rows.

  • Errors list the views, the columns of the views you used, or the join map. An empty result over an fqn without a leading backslash gets a hint.

  • The same views are downloadable as parquet under https://api.tresbien.tech/data/docs. Its cookbook targets api.duckdb plus prelude views this mirror does not have, so take recipes from describe_dataset.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "query_dataset"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlNoOne DuckDB SELECT over the views describe_dataset lists. SHOW TABLES, DESCRIBE <view> and FROM-first syntax also work. No semicolon, one statement. Use statements for several at once.
max_rowsNoRows to return per statement, 1 to 500 (default 100). The result byte budget may cut a wide result sooner. truncated says so either way.
statementsNoUp to 5 statements in one call. Results come back in order under results, each with its own rows or error. The byte budget is shared. Use this instead of sql for more than one statement.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • changedInput schema / properties / max_rows / description
      Previous value: -"Rows to return per statement, 1 to 500 (default 100). The result byte budget may cut a wide result sooner; truncated says so either way."New value: +"Rows to return per statement, 1 to 500 (default 100). The result byte budget may cut a wide result sooner. truncated says so either way."
    • changedInput schema / properties / sql / description
      Previous value: -"One DuckDB SELECT over the views listed in the description. SHOW TABLES, DESCRIBE <view> and FROM-first syntax also work. No semicolon; one statement. Use statements for several at once."New value: +"One DuckDB SELECT over the views describe_dataset lists. SHOW TABLES, DESCRIBE <view> and FROM-first syntax also work. No semicolon, one statement. Use statements for several at once."
    • changedInput schema / properties / statements / description
      Previous value: -"Up to 5 statements run in one call (explore in one round trip): results come back in order under results, each with its own rows or error; the byte budget is shared. Use instead of sql when you have more than one."New value: +"Up to 5 statements in one call. Results come back in order under results, each with its own rows or error. The byte budget is shared. Use this instead of sql for more than one statement."
  2. Changed5 schema fields changed
    • changedInput schema / properties / max_rows / description
      Previous value: -"Rows to return, 1 to 500 (default 100). The result byte budget may cut a wide result sooner; truncated says so either way."New value: +"Rows to return per statement, 1 to 500 (default 100). The result byte budget may cut a wide result sooner; truncated says so either way."
    • changedInput schema / properties / sql / description
      Previous value: -"One DuckDB SELECT over the views listed in the description. SHOW TABLES, DESCRIBE <view> and FROM-first syntax also work. No semicolon; one statement."New value: +"One DuckDB SELECT over the views listed in the description. SHOW TABLES, DESCRIBE <view> and FROM-first syntax also work. No semicolon; one statement. Use statements for several at once."
    • addedInput schema / properties / statements
      Added value: +{
      +  "description": "Up to 5 statements run in one call (explore in one round trip): results come back in order under results, each with its own rows or error; the byte budget is shared. Use instead of sql when you have more than one.",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": [
      +    "null",
      +    "array"
      +  ]
      +}
    • removedInput schema / required
      Removed value: -[
      -  "sql"
      -]
    • changedOutput schema / (root)
      Previous value: -{
      -  "additionalProperties": false,
      -  "properties": {
      -    "columns": {
      -      "items": {
      -        "additionalProperties": false,
      -        "properties": {
      -          "name": {
      -            "type": "string"
      -          },
      -          "type": {
      -            "type": "string"
      -          }
      -        },
      -        "required": [
      -          "name",
      -          "type"
      -        ],
      -        "type": "object"
      -      },
      -      "type": [
      -        "null",
      -        "array"
      -      ]
      -    },
      -    "hint": {
      -      "type": "string"
      -    },
      -    "row_count": {
      -      "type": "integer"
      -    },
      -    "rows": {
      -      "items": {
      -        "items": true,
      -        "type": [
      -          "null",
      -          "array"
      -        ]
      -      },
      -      "type": [
      -        "null",
      -        "array"
      -      ]
      -    },
      -    "truncated": {
      -      "type": "boolean"
      -    }
      -  },
      -  "required": [
      -    "columns",
      -    "rows",
      -    "row_count",
      -    "truncated"
      -  ],
      -  "type": "object"
      -}New value: +null
  3. Changed1 schema field changed
    • addedOutput schema / properties / hint
      Added value: +{
      +  "type": "string"
      +}
  4. Added

TDQS

A4.6/5.0
Behavior4/5

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

Annotations only cover the read-only/idempotent safety profile, and the description adds substantial behavior beyond that: 15 s limit, 16 KB result budget, per-statement errors, truncation signaling, sandbox boundary, and error payload contents. It stops short of describing pagination mechanics or whether limits apply per-statement or per-call, so it is strong but not exhaustive.

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 purpose and prerequisites before the mechanics, and each bullet carries distinct information. Some dataset-specific rules (dev-branch isolation, adoption polarity, the core_symbol_evidence/symbol_usage relationship) are long enough that they arguably belong in describe_dataset, which the description itself points to, creating mild redundancy.

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?

With no output schema, the description still supplies the return shape (columns plus row arrays), the truncation indicator, and the error contents, so an agent can interpret results without guessing. The schema-level and dataset-level pitfalls that would cause silently wrong queries are all surfaced.

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% and the schema already documents statements, max_rows, and their interaction, so the baseline is 3. The description still adds meaning the schema lacks: the concrete 16 KB ceiling and the remediation for a truncated result (aggregate, filter, or LIMIT/OFFSET), plus the distinction between one result/error per statement.

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 (read-only DuckDB SELECTs over the dataset) and scopes it explicitly as the fallback 'for a question none of them asks,' which distinguishes it from every typed sibling. The reader knows immediately this is an escape hatch, not the default path.

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?

Gives explicit ordering ('Call describe_dataset first'), names what that call yields (views, columns, joins, recipes), and states the exclusion 'Prefer a typed tool when one fits.' It also steers recipe-sourcing away from the external cookbook toward describe_dataset, closing a real ambiguity.

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