Skip to main content
POST
/
talk2data
/
mcp
/
generate-sql
Generate Sql
curl --request POST \
  --url https://api.example.com/talk2data/mcp/generate-sql \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "question": "<string>",
  "database": "<string>",
  "schemas": [
    {
      "schema_name": "<string>",
      "schema_fqn": "<string>",
      "selected_tables": [
        {
          "table_name": "<string>",
          "table_fqn": "<string>"
        }
      ]
    }
  ]
}
'
{
  "sql": "<string>",
  "explanation": "<string>",
  "assumptions": []
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Request body for synchronous SQL generation.

question
string
required

Natural language question to convert to SQL

Minimum string length: 1
database
string
required

Resource URI of the data connection (e.g. data:org:project:name)

Minimum string length: 1
schemas
DatasourceSelectedSchema · object[] | null

List of schemas to query. If not provided, defaults to 'public' schema.

Response

Successful Response

Synchronous SQL generation result.

sql
string
required
explanation
string
required
assumptions
string[]