by Metabase
Query tables and metrics
Runs a query against a table or saved metric through the semantic layer and returns the results.
Updated Sep 27, 2026
query-metrics.md
Query tables and metrics
Runs a query against a table or saved metric through the semantic layer and returns the results.
Note: Returns at most 200 rows per request: pass the returned continuation_token back for the next page.
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 query.
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.
API (official)
- Base URL: https://{metabase_host}
- Endpoint:
POST /api/agent/v1/query - Auth: send the header
X-API-Key: $METABASE_API_KEY - Docs: https://www.metabase.com/docs/latest/ai/agent-api
Note: {metabase_host} is your Metabase's address without https://; the key's group decides what it can read.
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.