Skip to main content
Glama
metabase-mcp

metabase-mcp

by livingroot

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

NameRequiredDescriptionDefault
sqlYesNative SQL query body
nameYesDisplay name for the saved question
displayNoVisualization type (default 'table'). Common values: 'table' | 'line' | 'bar' | 'area' | 'pie' | 'scalar' | 'smartscalar' | 'row' | 'combo' | 'scatter' | 'funnel' | 'waterfall' | 'gauge' | 'progress' | 'map' | 'pivot'.
tag_typesNoOverride 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_idYesMetabase database ID the SQL runs against
descriptionNoOptional description
tag_configsNoFull 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}}

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.3

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the whole behavioral burden, and it does disclose two useful traits: the call returns the new card ID, and field-filter widget_type is auto-detected from the target field's type and validated before saving (so a mismatch fails rather than silently persisting). It says nothing about required permissions, duplicate-name handling, or what happens to nested tag_configs when validation fails.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three dense sentences, front-loaded with purpose, then the return value, then the one caveat that matters for correctness. No filler; the only nit is that the third sentence jumps to widget_type without framing it as a tag_configs concern.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 7-parameter mutation tool with nested objects, no annotations, and no output schema, the description covers the essentials: what it creates, what it returns, and the validation behavior of the trickiest parameter. Missing error-shape and permission context is largely offset by the exhaustive schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so database_id, sql, name, display, tag_types, and tag_configs are all well documented in the schema itself. The description adds only the auto-detection/validation rule for widget_type, which the schema already repeats almost verbatim, so it does not meaningfully extend parameter meaning beyond structured data.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: creating a native SQL saved question (card) in Metabase from a database ID, SQL body, and display name. The scope is unambiguous and distinguishes it from cards_update (modifying an existing card) and queries_execute_sql (running ad-hoc SQL rather than persisting a saved question).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The word 'saved' implicitly signals this persists a question rather than executing a query ad hoc, which softly differentiates it from queries_execute_sql. However, there is no explicit when-to-use statement, no mention of prerequisites (e.g., needing the database_id from databases_list), and no named alternative for ad-hoc execution or for updating an existing card.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.