Skip to main content
Glama
metabase-mcp

metabase-mcp

by livingroot

queries_execute_sql

Execute raw or parameterized SQL against a Metabase database and return results as a Markdown table with adjustable row limits.

Instructions

Execute raw SQL against a database and return results as a Markdown table. Defaults to 50 rows; pass max_rows to adjust. Use queries_export for result sets exceeding 2,000 rows.

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": "queries_execute_sql"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlYesSQL query to execute
max_rowsNoMaximum rows to return (default 50)
parametersNoFilter parameters for {{template_tag}} placeholders in SQL
database_idYesMetabase database ID

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.3

TDQS

A3.9/5.0
Behavior3/5

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

With no annotations, the description carries the full burden, and it does disclose useful traits: results come back as a Markdown table, the default row cap is 50, and very large sets should go through export. It says nothing about whether arbitrary SQL may write/DDL, whether execution is sandboxed or read-only, or whether specific database permissions are required — a serious omission for a raw SQL execution tool.

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

Conciseness5/5

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

Three short sentences, front-loaded with what the tool does and the return format, then the limit, then the escalation path. Nothing is redundant or padded.

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

Completeness3/5

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

For a 4-parameter tool with full schema coverage and no output schema, the description adequately covers purpose, output shape, and the row-size escape hatch. It is incomplete on the risk profile — read-only vs. mutating SQL and permission prerequisites — which an agent needs before invoking raw query execution.

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 sql, max_rows, parameters, and database_id are already documented in the schema; the description only restates the max_rows default of 50. Under the high-coverage baseline, 3 is appropriate.

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 ('Execute raw SQL against a database') plus the return format (Markdown table), and explicitly contrasts with the sibling queries_export, so an agent can distinguish it from cards_execute without opening a schema.

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

Usage Guidelines4/5

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

Gives one concrete routing rule: use queries_export when result sets exceed 2,000 rows, which is exactly the kind of alternative-selection guidance that matters here. It stops short of saying when to prefer this over a saved card (cards_execute) or whether ad-hoc SQL is intended for exploratory reads only.

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