Raw SQLMax tier

query_sql

Run a read-only SELECT / WITH query against the underlying Postgres + PostGIS database. Forbidden keywords (INSERT/UPDATE/DELETE/DROP/CREATE/ALTER/TRUNCATE/COPY/…) are rejected. A statement_timeout is applied and the query is auto-LIMITed if no LIMIT clause is present. Max tier only.

Use cases

  • Compose ad-hoc cross-source analysis that no high-level tool covers.
  • Run a complex aggregation that combines OMI quotations + ISTAT census + earthquake history.
  • Prototype a feature on the live data before wiring it up as a high-level tool.
  • Pull back a large slice for offline analysis (subject to the auto-LIMIT cap of 1,000).

Arguments

NameTypeRequiredDescription
sql string required A single SELECT or WITH statement (no ;).
params array optional Positional parameters substituted as $1, $2, … (postgres.js).
limit integer optional Max rows.
Range 1 – 1,000.

Example request

curl
bash
curl -X POST https://mcp.qubitdata.it/mcp \
  -H "Authorization: Bearer $QUBITDATA_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "query_sql",
      "arguments": {
            "sql": "SELECT comune, AVG(compr_min) AS avg_compr FROM realestate.ade_omi_quotazioni WHERE anno = $1 GROUP BY comune ORDER BY avg_compr DESC",
            "params": [
                  2025
            ],
            "limit": 10
      }
    }
  }'

Example response

JSON-RPC 2.0 result
json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "content": [
      {
        "type": "text",
        "text": "[\n  { \"comune\": \"Portofino\", \"avg_compr\": 12500 },\n  { \"comune\": \"Capri\",     \"avg_compr\": 11800 }\n]"
      }
    ]
  }
}

Prompts to try

Drop these into Claude Desktop, Cursor, or any MCP-aware client wired to https://mcp.qubitdata.it/mcp.

  • Claude Desktop
    Top 10 comuni by average OMI compr_min in 2025. Use query_sql.
  • Cursor
    Cross-join OMI quotations with seismic exposure for every comune in Lombardia.
  • Custom MCP client
    Pull every healthcare facility within 10km of seismic events M ≥ 5 in the last 10 years.

Related tools

describe_table · list_sources · relationships_graph

Get started

Sign up for a free key to call this tool from your agent. Need a wider geo cap or higher quota? See pricing.

Last updated: