MCP tool
query
Run a SQL queryWrites
Run one read-only SELECT on one SQL source and store its result. Write the SQL in the dialect describe names for the table: BigQuery GoogleSQL (https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax, `project.dataset.table` in backticks), PostgreSQL (https://www.postgresql.org/docs/current/sql-select.html) or Trino SQL on Amazon Athena (https://docs.aws.amazon.com/athena/latest/ug/select.html), using the SQL names from describe. Guardrails refuse anything but one SELECT on catalogued tables. Not read-only: it starts a job at the source, its cost is checked against the per-query, per-session and monthly caps and then billed to the org's budget (estimate shows it first), and the result is stored for download. Returns the rows (rows=100 by default, up to 1000, as many as fit the response; format='csv' (default), 'markdown' or 'json'; columns=[names] to show only some), the result's size, a handle (res_…) and signed CSV / Parquet download links (they work with no key, for a few hours; result(handle) gives new ones until the handle expires). When not every row is shown, a summary of each column over the whole result comes with them. Repeating the same deterministic query while its result is cached returns that result at no extra cost; SQL with RAND(), CURRENT_TIMESTAMP() and the like runs and is billed again. Long queries return status=running: read them with result(handle), stop them with cancel(handle). Files and APIs are fetch-only: querying them answers not_queryable with how to get the data. Optional `intent`, as in search.
Parameters
sqlstringrequired- One SELECT statement using catalogued tables.
columnsanyoptional- Only these result columns in the response (names); the stored result and the downloads keep every column.
formatanyoptional- How rows are written: "csv" (default, the most compact), "markdown" or "json".
intentstringoptional- The user's underlying question, in one sentence.
max_rowsintegeroptional- Rows to keep in the result store (default and max set by the server). Range 0–….
rowsintegeroptional- Rows to show in this response (default 100, max 1000): all of them when the result is that small and they fit the response budget. Range 0–….
sourcestringoptional- Connection name, only needed if a table name exists on several sources.
wait_secondsintegeroptional- Seconds to wait before returning a running handle (default 25, max 55). Range 0–….
Input schema (JSON)
{
"$defs": {
"OneOrMany": {
"anyOf": [
{
"type": "string"
},
{
"items": {
"type": "string"
},
"type": "array"
}
],
"description": "One string or a list of them."
},
"RowFormat": {
"description": "How `query` and `result` write rows.",
"oneOf": [
{
"const": "csv",
"description": "A CSV code block: the fewest tokens, and easy to parse.",
"type": "string"
},
{
"const": "markdown",
"description": "A markdown table.",
"type": "string"
},
{
"const": "json",
"description": "A JSON code block: `{\"columns\": […], \"rows\": [[…], …]}` with typed values.",
"type": "string"
}
]
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"properties": {
"columns": {
"anyOf": [
{
"$ref": "#/$defs/OneOrMany"
},
{
"type": "null"
}
],
"default": null,
"description": "Only these result columns in the response (names); the stored result\nand the downloads keep every column."
},
"format": {
"anyOf": [
{
"$ref": "#/$defs/RowFormat"
},
{
"type": "null"
}
],
"default": null,
"description": "How rows are written: \"csv\" (default, the most compact), \"markdown\"\nor \"json\"."
},
"intent": {
"default": null,
"description": "The user's underlying question, in one sentence.",
"type": [
"string",
"null"
]
},
"max_rows": {
"default": null,
"description": "Rows to keep in the result store (default and max set by the server).",
"format": "uint64",
"minimum": 0,
"type": [
"integer",
"null"
]
},
"rows": {
"default": null,
"description": "Rows to show in this response (default 100, max 1000): all of them\nwhen the result is that small and they fit the response budget.",
"format": "uint64",
"minimum": 0,
"type": [
"integer",
"null"
]
},
"source": {
"default": null,
"description": "Connection name, only needed if a table name exists on several sources.",
"type": [
"string",
"null"
]
},
"sql": {
"description": "One SELECT statement using catalogued tables.",
"type": "string"
},
"wait_seconds": {
"default": null,
"description": "Seconds to wait before returning a running handle (default 25, max 55).",
"format": "uint64",
"minimum": 0,
"type": [
"integer",
"null"
]
}
},
"required": [
"sql"
],
"type": "object"
}