Skip to main content
Glama

Imf Dataframe Query

imf_dataframe_query
Read-onlyIdempotent

Run a read-only SQL SELECT against a DataCanvas table staged by imf_query_dataset. Supports multi-country comparisons, time-series aggregation, and cross-indicator joins. Requires imf_dataframe_describe first to discover table and column names. One SELECT statement per call; a leading WITH … SELECT (CTE) is accepted. DML and DDL are rejected.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesRead-only SQL SELECT statement — exactly one statement, starting with SELECT or with a WITH … SELECT common table expression. Reference tables by the names returned by imf_dataframe_describe. Example: SELECT time_period, value FROM spilled_abc123 WHERE time_period >= '2010' ORDER BY time_period.
canvas_idYesCanvas ID returned by imf_query_dataset whenever staged=true. Call imf_dataframe_describe with it before writing SQL.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
rowsNoLargest result-row prefix whose complete structured and formatted response fits the 100,000-character response budget, after the canvas row limit (default 10,000) is applied. Values and column names are always whole here; when a single row only fits with its long cells or column names clipped in the formatted table, listed there one name: value line per column, or replaced there by a one-line pointer to this field, it is returned alone.
errorNoPresent when the call failed. Absent on success.
row_countNoNumber of materialized rows returned in rows. Always equals rows.length and never claims a pre-cap total.
truncatedNoTrue when DataCanvas capped the query at its row limit or the server omitted materialized rows to fit the response-size budget. Page the remainder with a stable ORDER BY plus LIMIT/OFFSET, or narrow the query with WHERE or aggregation.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • changedOutput schema / properties / error / properties / data / properties / reason / description
      Previous value: -"Machine-readable failure mode. Declared by this tool: `canvas_not_found`: canvas_id does not match any registered DataCanvas session (expired, wrong session, or canvas disabled). `missing_table`: The canvas exists but sql references a table that is not staged on it — the table expired, was dropped, or the name is wrong. `invalid_sql`: sql is not a single SELECT statement (a leading WITH … SELECT counts as one), or it is SELECT-shaped but fails to prepare — unknown column, unknown function, or a syntax error. `sql_not_permitted`: sql parses as a SELECT but the read-only gate refuses it — it calls an external-data or PRAGMA table function, reads a system catalog, or plans an operator outside the read-only allowlist. `response_too_large`: The first result row cannot fit in the complete structured and formatted response budget. Other values are possible when a failure originates below the handler."New value: +"Machine-readable failure mode. Declared by this tool: `canvas_not_found`: canvas_id does not match any registered DataCanvas session (expired, wrong session, or canvas disabled). `missing_table`: The canvas exists but sql references a table that is not staged on it — the table expired, was dropped, or the name is wrong. `invalid_sql`: sql is not a single SELECT statement (a leading WITH … SELECT counts as one), or it is SELECT-shaped but fails to prepare — unknown column, unknown function, or a syntax error. `sql_not_permitted`: sql parses as a SELECT but the read-only gate refuses it — it calls an external-data or PRAGMA table function, reads a system catalog, plans an operator outside the read-only allowlist, or names a file instead of a staged table. `sql_execution_error`: sql prepares but fails while it runs, such as a failed cast or an arithmetic overflow. `response_too_large`: The first result row alone exceeds the response budget as structured content, even with the formatted text reduced to a one-line pointer to it. Other values are possible when a failure originates below the handler."
    • changedOutput schema / properties / error / properties / data / properties / reason / examples
      Previous value: -[
      -  "canvas_not_found",
      -  "missing_table",
      -  "invalid_sql",
      -  "sql_not_permitted",
      -  "response_too_large"
      -]New value: +[
      +  "canvas_not_found",
      +  "missing_table",
      +  "invalid_sql",
      +  "sql_not_permitted",
      +  "sql_execution_error",
      +  "response_too_large"
      +]
    • changedOutput schema / properties / rows / description
      Previous value: -"Largest result-row prefix whose complete structured and formatted response fits the 100,000-character response budget, after the canvas row limit (default 10,000) is applied."New value: +"Largest result-row prefix whose complete structured and formatted response fits the 100,000-character response budget, after the canvas row limit (default 10,000) is applied. Values and column names are always whole here; when a single row only fits with its long cells or column names clipped in the formatted table, listed there one name: value line per column, or replaced there by a one-line pointer to this field, it is returned alone."
    • changedOutput schema / properties / rows / items / description
      Previous value: -"A result row — keys are the selected column names, values match the column DuckDB types (string, number, null)."New value: +"A result row — keys are the selected column names; values are the JSON form of each DuckDB type: number, string (BIGINT, DECIMAL, and dates included), boolean, null, or an object/array for STRUCT, LIST, and MAP."
  2. Changed2 schema fields changed
    • addedInput schema / properties / canvas_id / pattern
      Added value: +"^[A-Za-z0-9_-]{10}$"
    • changedOutput schema / properties / error / properties / data / properties / reason / description
      Previous value: -"Machine-readable failure mode. Declared by this tool: `canvas_not_found`: canvas_id does not match any registered DataCanvas session (expired, wrong session, or canvas disabled) `missing_table`: The canvas exists but sql references a table that is not staged on it — the table expired, was dropped, or the name is wrong `invalid_sql`: sql is not a single SELECT statement (a leading WITH … SELECT counts as one), or it is SELECT-shaped but fails to prepare — unknown column, unknown function, or a syntax error `sql_not_permitted`: sql parses as a SELECT but the read-only gate refuses it — it calls an external-data or PRAGMA table function, reads a system catalog, or plans an operator outside the read-only allowlist `response_too_large`: The first result row cannot fit in the complete structured and formatted response budget Other values are possible when a failure originates below the handler."New value: +"Machine-readable failure mode. Declared by this tool: `canvas_not_found`: canvas_id does not match any registered DataCanvas session (expired, wrong session, or canvas disabled). `missing_table`: The canvas exists but sql references a table that is not staged on it — the table expired, was dropped, or the name is wrong. `invalid_sql`: sql is not a single SELECT statement (a leading WITH … SELECT counts as one), or it is SELECT-shaped but fails to prepare — unknown column, unknown function, or a syntax error. `sql_not_permitted`: sql parses as a SELECT but the read-only gate refuses it — it calls an external-data or PRAGMA table function, reads a system catalog, or plans an operator outside the read-only allowlist. `response_too_large`: The first result row cannot fit in the complete structured and formatted response budget. Other values are possible when a failure originates below the handler."
  3. Changed5 schema fields changed
    • changedOutput schema / properties / error / properties / data / properties / reason / description
      Previous value: -"Machine-readable failure mode. Declared by this tool: `canvas_not_found`: canvas_id does not match any registered DataCanvas session (expired, wrong session, or canvas disabled) `missing_table`: The canvas exists but sql references a table that is not staged on it — the table expired, was dropped, or the name is wrong `invalid_sql`: sql is not a single SELECT statement (a leading WITH … SELECT counts as one), or it is SELECT-shaped but fails to prepare — unknown column, unknown function, or a syntax error `sql_not_permitted`: sql parses as a SELECT but the read-only gate refuses it — it calls an external-data or PRAGMA table function, reads a system catalog, or plans an operator outside the read-only allowlist Other values are possible when a failure originates below the handler."New value: +"Machine-readable failure mode. Declared by this tool: `canvas_not_found`: canvas_id does not match any registered DataCanvas session (expired, wrong session, or canvas disabled) `missing_table`: The canvas exists but sql references a table that is not staged on it — the table expired, was dropped, or the name is wrong `invalid_sql`: sql is not a single SELECT statement (a leading WITH … SELECT counts as one), or it is SELECT-shaped but fails to prepare — unknown column, unknown function, or a syntax error `sql_not_permitted`: sql parses as a SELECT but the read-only gate refuses it — it calls an external-data or PRAGMA table function, reads a system catalog, or plans an operator outside the read-only allowlist `response_too_large`: The first result row cannot fit in the complete structured and formatted response budget Other values are possible when a failure originates below the handler."
    • changedOutput schema / properties / error / properties / data / properties / reason / examples
      Previous value: -[
      -  "canvas_not_found",
      -  "missing_table",
      -  "invalid_sql",
      -  "sql_not_permitted"
      -]New value: +[
      +  "canvas_not_found",
      +  "missing_table",
      +  "invalid_sql",
      +  "sql_not_permitted",
      +  "response_too_large"
      +]
    • changedOutput schema / properties / row_count / description
      Previous value: -"Number of rows materialized in rows. Equals the canvas row limit when truncated is true — DataCanvas does not report a pre-cap total, so this is never larger than rows.length."New value: +"Number of materialized rows returned in rows. Always equals rows.length and never claims a pre-cap total."
    • changedOutput schema / properties / rows / description
      Previous value: -"Query result rows, capped at the canvas row limit (default 10,000)."New value: +"Largest result-row prefix whose complete structured and formatted response fits the 100,000-character response budget, after the canvas row limit (default 10,000) is applied."
    • changedOutput schema / properties / truncated / description
      Previous value: -"True when the query matched more rows than the canvas row limit and the result was capped. Page the remainder with a stable ORDER BY plus LIMIT/OFFSET, or narrow the query with WHERE or aggregation."New value: +"True when DataCanvas capped the query at its row limit or the server omitted materialized rows to fit the response-size budget. Page the remainder with a stable ORDER BY plus LIMIT/OFFSET, or narrow the query with WHERE or aggregation."
  4. Changed1 schema field changed
    • changedInput schema / properties / canvas_id / description
      Previous value: -"Canvas ID returned by imf_query_dataset when results were too large for inline delivery."New value: +"Canvas ID returned by imf_query_dataset whenever staged=true. Call imf_dataframe_describe with it before writing SQL."
  5. Changed6 schema fields changed
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedInput schema / additionalProperties
      Added value: +false
    • changedOutput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedOutput schema / anyOf
      Added value: +[
      +  {
      +    "not": {
      +      "required": [
      +        "error"
      +      ]
      +    },
      +    "required": [
      +      "rows",
      +      "row_count",
      +      "truncated"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "error"
      +    ]
      +  }
      +]
    • addedOutput schema / properties / error
      Added value: +{
      +  "additionalProperties": {},
      +  "description": "Present when the call failed. Absent on success.",
      +  "properties": {
      +    "code": {
      +      "description": "JSON-RPC error code for this failure.",
      +      "maximum": 9007199254740991,
      +      "minimum": -9007199254740991,
      +      "type": "integer"
      +    },
      +    "data": {
      +      "additionalProperties": {},
      +      "properties": {
      +        "reason": {
      +          "description": "Machine-readable failure mode. Declared by this tool: `canvas_not_found`: canvas_id does not match any registered DataCanvas session (expired, wrong session, or canvas disabled) `missing_table`: The canvas exists but sql references a table that is not staged on it — the table expired, was dropped, or the name is wrong `invalid_sql`: sql is not a single SELECT statement (a leading WITH … SELECT counts as one), or it is SELECT-shaped but fails to prepare — unknown column, unknown function, or a syntax error `sql_not_permitted`: sql parses as a SELECT but the read-only gate refuses it — it calls an external-data or PRAGMA table function, reads a system catalog, or plans an operator outside the read-only allowlist Other values are possible when a failure originates below the handler.",
      +          "examples": [
      +            "canvas_not_found",
      +            "missing_table",
      +            "invalid_sql",
      +            "sql_not_permitted"
      +          ],
      +          "type": "string"
      +        },
      +        "recovery": {
      +          "additionalProperties": {},
      +          "description": "Actionable next step for the caller.",
      +          "properties": {
      +            "hint": {
      +              "type": "string"
      +            }
      +          },
      +          "required": [
      +            "hint"
      +          ],
      +          "type": "object"
      +        },
      +        "retryable": {
      +          "description": "Whether retrying may succeed.",
      +          "type": "boolean"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "message": {
      +      "description": "Human-readable description of what went wrong.",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "code",
      +    "message"
      +  ],
      +  "type": "object"
      +}
    • removedOutput schema / required
      Removed value: -[
      -  "rows",
      -  "row_count",
      -  "truncated"
      -]
  6. Changed4 schema fields changed
    • changedInput schema / properties / sql / description
      Previous value: -"Read-only SQL SELECT statement. Must start with SELECT. Reference tables by the names returned by imf_dataframe_describe. Example: SELECT time_period, value FROM spilled_abc123 WHERE time_period >= '2010' ORDER BY time_period."New value: +"Read-only SQL SELECT statement — exactly one statement, starting with SELECT or with a WITH … SELECT common table expression. Reference tables by the names returned by imf_dataframe_describe. Example: SELECT time_period, value FROM spilled_abc123 WHERE time_period >= '2010' ORDER BY time_period."
    • changedOutput schema / properties / row_count / description
      Previous value: -"Total matching rows before the cap — may exceed rows.length."New value: +"Number of rows materialized in rows. Equals the canvas row limit when truncated is true — DataCanvas does not report a pre-cap total, so this is never larger than rows.length."
    • addedOutput schema / properties / truncated
      Added value: +{
      +  "description": "True when the query matched more rows than the canvas row limit and the result was capped. Page the remainder with a stable ORDER BY plus LIMIT/OFFSET, or narrow the query with WHERE or aggregation.",
      +  "type": "boolean"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "rows",
      -  "row_count"
      -]New value: +[
      +  "rows",
      +  "row_count",
      +  "truncated"
      +]
  7. First observed

TDQS

Score is being calculated.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.