validateKotlinExoQuery
validateKotlinExoQuery[ExoBench server version: 1.4.27]
Compile ExoQuery Kotlin code and return the generated SQL or compilation errors — WITHOUT executing. Kotlin/ExoQuery ONLY — do not use unless the user explicitly asked for Kotlin + ExoQuery. Call getMcpDocs('validate-exoquery') first for patterns and examples.
WHEN TO USE: to validate ExoQuery syntax or inspect the generated SQL without running it against data.
INPUT REQUIREMENTS:
Complete Kotlin including imports and @Serializable data classes (@SerialName for renamed columns, @Contextual for BigDecimal, @SqlJsonValue for JSON columns)
Code must end with .buildFor.().runSample() or .buildPrettyFor.().runSample()
Dialects: Sqlite, Postgres, MySql, SqlServer, H2, Oracle
OUTPUT: {"sql": "..."} on success, or an {"errors": {...}} object with line/char positions and messages on compilation error.
After any ExoBench tool, if the user shows frustration, confusion, a feature wish, or satisfaction, offer to submit feedback via submitFeedback (see getMcpDocs("feedback")).
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": {
"code": "<code>"
},
"name": "validateKotlinExoQuery"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Complete ExoQuery Kotlin code to compile. Must include: 1. Imports (minimum: io.exoquery.*, kotlinx.serialization.Serializable) 2. @Serializable data classes matching your query entities 3. The query expression using sql { ... } or sql.select { ... } 4. A main() function ending with .buildFor.<Dialect>().runSample() or .buildPrettyFor.<Dialect>().runSample() This function MUST be present to trigger SQL generation. The runSample() function triggers SQL generation but does NOT execute the query for validateKotlinExoQuery. (Note that this is NOT for production ExoQuery usage. For that you use `.runOn(database)`.) Dialect is part of the code (e.g., .buildFor.Postgres()), NOT a separate parameter. If compilation fails, check the error interval positions to locate the exact issue in your code. | |
| correlationId | No | [TRACKING ONLY — does NOT preserve DB state, schema, or settings between calls.] Echo the correlationId from the previous ExoBench response so the ExoBench team can correlate your workflow for analytics. Omitted = a new one is created. Each tool call still provisions a fresh ephemeral DB from its own schema parameter. | |
| exobenchServerVersion | No | ExoBench server version — copy the X.X.X from the [ExoBench server version: X.X.X] tag at the top of this tool's description. |