Scale Intelligence■ Docs
Docs / Reference / ask: sql

ask: sql.

A query, in a strategy to rows, with how many and whether a bound was reached

Figure 1POST /v1/ask/sqlspecified
CALLERyour app or an agentholds the keyAPI GATEWAY/v1/ask/sql4 headersCORE: ASKrung strategygrant askRECORDreads or writesCARD, 200body SqlAnswerThe input is SqlInput. Every response carries the contract's hash.flows forwardthe result
The caller sends SqlInput to /v1/ask/sql. The platform returns a card whose body is SqlAnswer.
POST/v1/ask/sql

Ask the workbench. The call needs the strategy rung under a token with the ask grant, and it is served by either, by the size bound.

The route takes SqlInput and returns a card whose body is SqlAnswer.

Request body#

The request body is SqlInput.

fieldtyperequirednote
querytextyes
strategyidyes
boundcountno

Response#

The route returns a card whose body is SqlAnswer. Every card ends with a foot that states the basis of each number, the scope of the call, and the time when the facts were true.

Headers#

headerrequiredmeaning
Scale-Scopeyesthe scope the call runs in: tenant/, then /brand/, then /strategy/
Scale-As-True-Onnothe date the facts must have been true on; defaults to now
Scale-As-Known-Onnothe date the facts must have been known on; defaults to now
Scale-Keynofor a change, the key made from the input; a repeat under the same key returns the unit held and writes nothing

A caller needs the strategy rung and a token with the ask grant. The platform or the desktop app serves this route.

Example#

The example sends the smallest body that SqlInput allows. The build validates it against the schema of SqlInput.

Example
curl -X POST https://api.scaleintelligence.co/v1/ask/sql \
  -H "Scale-Key: $SCALE_KEY" -H "Scale-Scope: tenant/<id>" \
  -H "content-type: application/json" \
  -d '{ "query": "…", "strategy": "…" }'
import { client } from "@scale/sdk";
const answer = await client.ask.sql({
    "query": "…",
    "strategy": "…"
  });
// answer.body is a SqlAnswer. answer.foot holds the basis, the scope and the time.
import requests
answer = requests.post("https://api.scaleintelligence.co/v1/ask/sql",
    headers={"Scale-Key": KEY, "Scale-Scope": "tenant/<id>"},
    json={
      "query": "…",
      "strategy": "…"
    }).json()
let answer: Card = client.post("https://api.scaleintelligence.co/v1/ask/sql")
    .header("Scale-Key", key).header("Scale-Scope", "tenant/<id>")
    .json(&SqlInput { /* the fields of the page */ }).send().await?.json().await?;

MCP tool#

The MCP tool si.ask.sql takes the same input and returns the same card. The tool only reads data. An MCP host that renders cards draws this card from ui://scale-intelligence/cards/SqlAnswer. The tool’s page describes it.

POST /v1/ask/sql
Scale-Scope: …
Scale-As-True-On: …
Scale-As-Known-On: …
Scale-Key: …
content-type: application/json

{
  "query": "…",
  "strategy": "…"
}
Without a key, this page shows the request only. The request body is SqlInput, and the route returns a card whose body is SqlAnswer.

Claims#

claimstateroute or tool
The platform serves the route /v1/ask/sql at contract 0476e35e6e275db5.target/v1/ask/sql