execute_query
Run a SQL SELECT query on a Metabase database and retrieve results with options for field selection, pagination, and response format.
Instructions
Execute a SQL query (SELECT statements only)
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": {
"database_id": "<database_id>",
"sql": "<sql>"
},
"name": "execute_query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| database_id | Yes | Database ID to query | |
| sql | Yes | SQL query (SELECT statements only) | |
| fields | No | Column names to include in results (default: all) | |
| format | No | Response format (default: compact). Use "default" for pretty-printed output | |
| limit | No | Max rows to return (default: server maxRows setting) | |
| offset | No | Row offset for pagination |