Run saved query
run_saved_queryRun a saved query from the team library by id and return its rows, in the same shape as execute_query. Prefer it over execute_query whenever list_queries has a query that answers the question: the saved SQL runs unchanged on the query's own connection, and you pass only the values for its {{variables}}, never SQL. On an approved_queries connection it is the only way to get data, and only queries shared with the team (isShared true) may run. Call get_query first to see which variables it declares, their types and which are required. Values are type-checked and escaped server side; if any value is missing or invalid, nothing runs and the error names each variable and what is wrong with it. Read-only: the filled-in SQL must be a single SELECT, WITH or EXPLAIN. A repeated identical run may return a result cached for up to 5 minutes unless refresh is true. Counts against the company's monthly query quota and a limit of 30 queries per minute (the team can set a lower one per connection). Needs the execute scope; works for viewers too. Fails if the saved query has no connection or its connection is paused. The team can require a person to approve some requests: the call then fails with code APPROVAL_REQUIRED and an approvalUrl. Show the user that link, wait until they say it is approved, then repeat the exact same call with approvalId. An approval works once, for that SQL, within 30 minutes.
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": {
"id": "<id>"
},
"name": "run_saved_query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Saved query id from list_queries. | |
| limit | No | Maximum rows to return, 1 to 10000. Defaults to 1000. The team can set a lower limit per connection. The result's truncated flag is true when rows were cut. | |
| values | No | Variable values keyed by variable name, all as strings, e.g. {"start": "2026-01-01", "region": "EU"}. Formats: date YYYY-MM-DD, number plain digits such as 42 or -3.5, boolean true or false, dropdown one of the variable's options. An omitted variable takes its saved default; one sent as an empty string stays empty, which fails if it is required. | |
| refresh | No | Skip the result cache and read the database now. Omit to allow a result cached in the last 5 minutes. | |
| timeZone | No | IANA time zone used to resolve relative date defaults such as today or start_of_this_month, e.g. Europe/Helsinki. Defaults to UTC. | |
| approvalId | No | Only when repeating a call that came back with APPROVAL_REQUIRED, after the user approved it. Send the same arguments again. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | No | ||
| success | No |