251
All tools

Run a SQL query

Runs a native SQL query against a connected database and returns the rows.

Updated Sep 27, 2026

run-sql-query.md

Run a SQL query

Runs a native SQL query against a connected database and returns the rows.

Note: Needs native-query permission on the target database.

Set up

Use the first option your agent supports.

MCP (official, remote)

Add this server to your agent's MCP settings, then sign in when asked.

{ "mcpServers": { "metabase": { "url": "https://{metabase_host}/api/metabase-mcp" } } }

Call the MCP tool execute_sql.

Server URL: https://{metabase_host}/api/metabase-mcp

Note: {metabase_host} is your Metabase's address without https://. An admin turns the MCP server on under Admin > AI > MCP.

Before anything else, confirm access with the cheapest read-only call, like a list or a search. Never send or change anything to test access.

Rules

  • Ask the user before anything that sends messages, costs money, or changes data, and say how many records it touches. One approval covers a batch the user has seen.
  • Never print API keys.

Ways in

RouteSourceCallRequiredDocs
MCPOfficial · remoteexecute_sqlOAuthDocs

Workflows using Run a SQL query

No workflows yet
No published workflow uses Run a SQL query yet.