peaka_execute_sql_query
Run Trino SQL queries against a Peaka project to retrieve results as columns and rows, with errors showing the failing line and column for fixes.
Instructions
Runs the given SQL on Peaka. The SQL is Trino: catalog.schema.table names as listed; DATE '2025-01-31' and INTERVAL '30' DAY literals; integer division truncates (CAST to DOUBLE for ratios); NOT EXISTS instead of NOT IN when NULLs are possible; aggregate in SQL. A failing query returns Trino's message with its line and column: fix that part and run again. Full rules: the peaka_sql_query_rule_set resource.
BEFORE RUNNING THIS TOOL:
1: Find the tables with peaka_list_project_tables (one line a table, with its cache state), then read the chosen tables' columns with peaka_get_project_metadata and tables=[...] in one call. If the project is too large to list, list one schema or use peaka_search_relevant_tables.
2: Check how the tables are read in that list: each schema's header says SaaS source or database, and a SaaS table marked [cached] is read from the cache; peaka_list_tables gives it per schema too
3: A SaaS table not marked [cached] is read live, and a live read may return only its first page of records: say the result may be incomplete, and, if caching tools are available, offer to cache the table. Do not start a cache without the user's yes.
The answer is { columns, rows, returnedRows, totalRows }; a large result is cut (truncated: true, with a note): aggregate or narrow in SQL instead of reading rows.
4: A database table (e.g. Oracle) is always read live and in full: caching does not make its answer more complete. If a query on it fails or is slow, fix or narrow the SQL, or report the error; do not try to cache it.
If you do not already know the projectId for the current task, call peaka_list_projects first and ask the user which project to use. Remember the chosen projectId for subsequent calls in this conversation.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": {
"projectId": "<projectId>",
"query": "<query>"
},
"name": "peaka_execute_sql_query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| projectId | Yes | The Peaka project ID to run against. |