Raw SQLMax

query_sql

Esegui una query SELECT / WITH read-only sul database Postgres + PostGIS sottostante. Le keyword vietate (INSERT/UPDATE/DELETE/DROP/CREATE/ALTER/TRUNCATE/COPY/…) vengono rifiutate. Viene applicato statement_timeout e la query è auto-LIMITata se manca un LIMIT esplicito. Solo tier Max.

Use cases

  • Componi analisi cross-source ad-hoc che nessun tool high-level copre.
  • Esegui aggregazioni complesse che combinano quotazioni OMI + ISTAT + storia sismica.
  • Prototipa una feature sui dati live prima di esporla come tool high-level.
  • Estrai una slice ampia per analisi offline (soggetto al cap auto-LIMIT 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]"
      }
    ]
  }
}

Prompt da provare

Incollali in Claude Desktop, Cursor o un qualsiasi client MCP collegato a https://mcp.qubitdata.it/mcp.

  • Claude Desktop
    Top 10 comuni per OMI compr_min medio nel 2025. Usa query_sql.
  • Cursor
    Cross-join quotazioni OMI con esposizione sismica per ogni comune della Lombardia.
  • Client MCP custom
    Estrai ogni struttura sanitaria entro 10km da eventi sismici M ≥ 5 negli ultimi 10 anni.

Related tools

describe_table · list_sources · relationships_graph

Get started

Registrati per una free key e richiama il tool dal tuo agente. Servono cap geografici più ampi o quota più alta? Vedi pricing.

Last updated: