AI agents · OpenClaw · self-hosting · automation

Quick Answer

Best Text-to-SQL Tools for AI Agents and Complex Databases

Published:

The short answer

Do not hand an agent a database connection and a schema dump. For complex enterprise databases — hundreds of tables, multi-step joins, business-specific calculations — the tools that work put a semantic layer between the agent and the SQL. As of November 2, 2026:

  1. Data in Snowflake: Snowflake-managed MCP server exposing a Cortex Agent (or Cortex Analyst) grounded in semantic views.
  2. Data in Databricks: the Genie Agent MCP server, one curated Genie Agent per domain.
  3. Metrics already defined in dbt: the dbt MCP server and its query_metrics tool.
  4. Microsoft shop: Fabric data agents (GA, F2 capacity or higher).
  5. Several databases, or embedding in your product: WrenAI with its MCP server.
  6. You want to write the tools yourself: Google’s open-source MCP Toolbox for Databases.

This page is the agent-facing spoke of our best text-to-SQL tools guide, which covers the human analyst side.

The comparison

ToolHow the agent connectsGrounding for complex joinsPermissionsCost model (Nov 2, 2026)
Snowflake managed MCP serverMCP; tools: Cortex Agents, Cortex Analyst, Cortex Search, SYSTEM_EXECUTE_SQL, customSemantic views + verified queriesRBAC per server and tool; Snowflake OAuth or External OAuthAI Credits: $2.00 global / $2.20 regional routing; standalone Analyst API per 1,000 messages; plus warehouse compute
Databricks Genie Agent MCPMCP, /api/2.0/mcp/genie/{space_id}Genie Agent with up to 50 tables, views or metric viewsUnity Catalog on every requestDatabricks SQL pricing
dbt MCP serverMCP; query_metrics, list_metrics, text_to_sql, execute_sqldbt Semantic Layer metrics and dimensionsYour dbt Platform and warehouse rolesdbt plan + warehouse
Fabric data agentFabric, Microsoft 365 Copilot, multi-agent appsInstructions, examples, Power BI semantic modelsAsking user’s read permissionFabric capacity, F2 or higher
WrenAIMCP server, embedded APISemantic modelling, dbt integrationRBAC; row/column-level on EnterpriseEssential $179/mo, Enterprise $559/mo (annual)
MCP Toolbox for DatabasesMCP; prebuilt list_tables, execute_sql + custom toolsWhatever you encode in custom toolsYour credentials and query designOpen source, self-hosted

1. Snowflake managed MCP server — best for Snowflake

The Snowflake-managed MCP server lets agents retrieve data without you deploying separate infrastructure. It can serve Cortex Analyst, Cortex Search and Cortex Agents as tools, plus custom tools and SQL execution, up to 50 tools per server. The important design guidance is in Snowflake’s own docs: expose a Cortex Agent as the only client-facing tool for governed business questions, because exposing SYSTEM_EXECUTE_SQL on the same server lets the client bypass semantic views and verified queries. If you need raw SQL, put it on a separate server with a least-privileged role.

Cost: Cortex Agents bill AI Credits per million tokens ($2.00 per AI Credit with global routing, $2.20 with regional routing for data residency); Cortex Analyst invoked through an agent uses the same model, while the standalone Analyst API bills per 1,000 messages. Every generated query also runs on your warehouse.

2. Databricks Genie Agent MCP server — best for Databricks

Each Genie Agent MCP endpoint is scoped to one Genie Agent: a curated set of up to 50 Unity Catalog tables, views or metric views. The agent sends a plain-language question; Genie writes and runs the SQL and returns results, with Unity Catalog permissions enforced on every request. Two limits matter: it is read-only, and it passes no conversation history (use Databricks’ AI Bridge from Python for follow-ups). Calls bill at Databricks SQL rates, and a workspace admin must enable Managed MCP Servers on the Previews page.

The 50-object cap is a feature for complex schemas: build one Genie Agent per domain (finance, supply chain) with metric views for the hard calculations, rather than one space over everything.

3. dbt MCP server — best when metrics live in dbt

If revenue, churn and margin are already defined in the dbt Semantic Layer, let the agent call list_metrics, get_dimensions and query_metrics instead of writing SQL. The metric definitions carry the joins and aggregations, so “net revenue by region last quarter” returns the number finance agrees with. text_to_sql and execute_sql exist for the long tail. Works across warehouses that dbt supports.

4. Microsoft Fabric data agents — best for Microsoft shops

Fabric data agents are generally available and run on any paid F2 or higher capacity (or Power BI Premium P1+). The agent routes each question to the right source and uses NL2SQL for lakehouses and warehouses, NL2DAX for Power BI semantic models and NL2KQL for KQL databases. For Power BI models it uses the asking user’s Read permission. One agent can combine up to five data sources, it only generates read queries, and you can add organisation-specific instructions and example question/query pairs (not yet supported for Power BI semantic model sources).

5. WrenAI — best across databases

WrenAI’s MCP server and embedded API give agents the same semantic model human users query. Pricing is per credit with unlimited members: Essential Cloud $179/month (13,200 annual credits) and Enterprise Cloud $559/month (24,000 annual credits, row- and column-level control, audit logs), billed annually; agents and humans draw from the same pool. Self-hosted Enterprise Plus is quoted by concurrent sessions.

6. MCP Toolbox for Databases — best for custom tools

Google’s open-source MCP Toolbox (renamed from genai-toolbox) has two modes: prebuilt generic tools such as list_tables and execute_sql for developer exploration, and a custom tools framework where you define parameterised queries the production agent may call. For complex enterprise logic, the second mode is the safe one: you encode the join once, the agent fills in parameters.

How to handle complex joins and calculations

  • Encode the hard parts once: metric views (Databricks), semantic views (Snowflake), dbt metrics, or parameterised tools. The model should choose a metric, not invent a five-way join.
  • Curate scope: fewer, documented tables per agent beat the whole warehouse.
  • Keep a verified-question set of 20–50 real business questions with known answers and re-run it on every model or schema change.
  • Separate read paths from SQL execution and give the raw-SQL path the narrowest role.

Last verified: November 2, 2026. Features and prices from vendor documentation and pricing pages read that day.

Sources