Generate a read-only SQL query from a question and a schema
sql_generateSQL from a question and a schema (CREATE TABLE statements or a JSON description of tables and columns), for postgres (default), mysql, sqlite or bigquery. The tables and columns used are checked against the schema; a query that does not match it is retried once, then refused. Writes (INSERT, UPDATE, DELETE, DDL) are refused unless allowWrite is true. The query is not run. Price: $0.003 per successful call, paid with x402 (USDC on Base, Solana and 10 more networks); failed calls are not charged.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"question": "<question>",
"schema": "<schema>"
},
"name": "sql_generate"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| schema | Yes | CREATE TABLE statements, or a JSON object of tables and column lists (max 20,000 characters) | |
| dialect | No | postgres (default), mysql, sqlite or bigquery | |
| question | Yes | Question in plain language (max 1,000 characters) | |
| allowWrite | No | Allow INSERT, UPDATE, DELETE or DDL (default false) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | No | ||
| note | No | ||
| tables | No | ||
| columns | No | ||
| dialect | No | ||
| readOnly | No | ||
| checkedAt | No | ||
| explanation | No |