cards_create
Create a native SQL saved question in Metabase from a database ID, SQL query, and display name; returns the new card ID and auto-detects field filter widgets.
Instructions
Create a native SQL saved question in Metabase from a database ID, SQL query, and display name. Returns the new card ID. Field Filter widget_type is auto-detected from the target field's type when omitted and validated against it before saving.
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": "<name>"
},
"name": "cards_create"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | Native SQL query body | |
| name | Yes | Display name for the saved question | |
| display | No | Visualization type (default 'table'). Common values: 'table' | 'line' | 'bar' | 'area' | 'pie' | 'scalar' | 'smartscalar' | 'row' | 'combo' | 'scatter' | 'funnel' | 'waterfall' | 'gauge' | 'progress' | 'map' | 'pivot'. | |
| tag_types | No | Override the Metabase type for specific {{template_tag}} variables. Map of tag name to type: 'text' | 'date' | 'number' | 'dimension'. Example: {"start_date": "date", "amount": "number"} | |
| database_id | Yes | Metabase database ID the SQL runs against | |
| description | No | Optional description | |
| tag_configs | No | Full tag configuration for {{template_tag}} variables. Supersedes tag_types. Use for dimension tags: set type='dimension', field_id=<id> to create a working dashboard filter; widget_type is auto-detected from the field's type when omitted and validated against it before saving. Example: {"sprint_name": {"type": "dimension", "field_id": 12694}} |