Since release 1.7, Data API builder (DAB) has had MCP support to securely provide agents access to your production data. To support small and massive databases, DAB consolidates operations into five, shared MCP tools that safely Create, Read, Update, and Delete. These are specifically designed to reduce token context window consumption.
Learn more about Data API builder: https://aka.ms/dab/mcp
What makes DAB’s MCP capabilities special is not just protecting the context window, but also protecting the database. RBAC security and custom policies are just the beginning. Data API builder rejects NL2SQL, the SQL injection of the agentic age, and instead provides an abstract query builder that ensures deterministic, safe SQL is sent to your database. It is a game changer.
Today, as we prepare for our March update, we are finishing a new tool dedicated to sophisticated aggregates that allows models to ask simple questions like “How many products do I have?” but also extremely complex questions like the ones below. All of this without requiring your database be exposed through raw sql to an AI agent.
Database Enablement
What is important to remember is that denormalization is not required, but it often makes this better. You can operate directly against a clean, normalized schema and still get safe, deterministic aggregates. However, thoughtfully introducing views that eliminate joins, or precomputed fields like inventoryValue or quarterlyRevenue, can simplify queries, improve performance, and make complex questions easier for models to express. The database remains authoritative and protected, while you decide how much shaping improves clarity and speed.Strategic customer importance
Who is our most important customer based on total revenue over the past 12 months, considering only active customers and returning the top customer by totalRevenue?
Tool syntax your agent will generate
{
"entity": "CustomerSales",
"function": "sum",
"field": "totalRevenue",
"filter": "isActive eq true and orderDate ge 2025-01-01",
"groupby": ["customerId", "customerName"],
"orderby": "desc",
"first": 1
}
SQL translation Data API builder will create
SELECT customerId, customerName, SUM(totalRevenue) AS sum_totalRevenue
FROM CustomerSales
WHERE isActive = 1 AND orderDate >= '2025-01-01'
GROUP BY customerId, customerName
ORDER BY SUM(totalRevenue) DESC
LIMIT 1;
Example data
| customerId | customerName | sum_totalRevenue |
|---|---|---|
| C1023 | Contoso Ltd | 8,450,000 |
Product discontinuation candidate
Which product should we consider discontinuing based on the lowest totalRevenue over the past 12 months among products currently marked as active and in stock?
Tool syntax your agent will generate
{
"entity": "ProductSales",
"function": "sum",
"field": "totalRevenue",
"filter": "isActive eq true and inStock gt 0 and orderDate ge 2025-01-01",
"groupby": ["productId", "productName"],
"orderby": "asc",
"first": 1
}
SQL translation Data API builder will create
SELECT productId, productName, SUM(totalRevenue) AS sum_totalRevenue
FROM ProductSales
WHERE isActive = 1 AND inStock > 0 AND orderDate >= '2025-01-01'
GROUP BY productId, productName
ORDER BY SUM(totalRevenue) ASC
LIMIT 1;
Example data
| productId | productName | sum_totalRevenue |
|---|---|---|
| P884 | Legacy Widget X | 12,450 |
Forward-looking performance expectation
Based on last year’s performance, what is the average quarterlyRevenue per region, and which regions averaged more than $2,000,000 per quarter?
Tool syntax your agent will generate
{
"entity": "QuarterlyPerformance",
"function": "avg",
"field": "quarterlyRevenue",
"filter": "fiscalYear eq 2025",
"groupby": ["region"],
"having": { "gt": 2000000 },
"orderby": "desc"
}
SQL translation Data API builder will create
SELECT region, AVG(quarterlyRevenue) AS avg_quarterlyRevenue
FROM QuarterlyPerformance
WHERE fiscalYear = 2025
GROUP BY region
HAVING AVG(quarterlyRevenue) > 2000000
ORDER BY AVG(quarterlyRevenue) DESC;
Example data
| region | avg_quarterlyRevenue |
|---|---|
| Southwest | 3,250,000 |
| Midwest | 2,480,000 |
Revenue concentration across regions
What is the total revenue of active retail customers in the Midwest and Southwest regions, grouped by region and customerTier, returning only tier-region combinations where total revenue exceeds $5,000,000 and ordered from highest to lowest?
Tool syntax your agent will generate
{
"entity": "CustomerSales",
"function": "sum",
"field": "totalRevenue",
"filter": "isActive eq true and customerType eq 'Retail' and (region eq 'Midwest' or region eq 'Southwest')",
"groupby": ["region", "customerTier"],
"having": { "gt": 5000000 },
"orderby": "desc"
}
SQL translation Data API builder will create
SELECT region, customerTier, SUM(totalRevenue) AS sum_totalRevenue
FROM CustomerSales
WHERE isActive = 1
AND customerType = 'Retail'
AND (region = 'Midwest' OR region = 'Southwest')
GROUP BY region, customerTier
HAVING SUM(totalRevenue) > 5000000
ORDER BY SUM(totalRevenue) DESC;
Example data
| region | customerTier | sum_totalRevenue |
|---|---|---|
| Southwest | Gold | 9,200,000 |
| Midwest | Platinum | 6,750,000 |
Risk exposure by product line
For discontinued products with onHandValue greater than zero, what is the total onHandValue by productLine and warehouseRegion, showing only groups whose combined value exceeds $2,500,000?
Tool syntax your agent will generate
{
"entity": "Inventory",
"function": "sum",
"field": "onHandValue",
"filter": "discontinued eq true and onHandValue gt 0",
"groupby": ["productLine", "warehouseRegion"],
"having": { "gt": 2500000 },
"orderby": "desc"
}
SQL translation Data API builder will create
SELECT productLine, warehouseRegion, SUM(onHandValue) AS sum_onHandValue
FROM Inventory
WHERE discontinued = 1 AND onHandValue > 0
GROUP BY productLine, warehouseRegion
HAVING SUM(onHandValue) > 2500000
ORDER BY SUM(onHandValue) DESC;
Example data
| productLine | warehouseRegion | sum_onHandValue |
|---|---|---|
| Appliances | West | 3,900,000 |
| Tools | Central | 2,850,000 |
Soon, SQL MCP Server will have this ability and so will you. What will you ask?
0 comments
Be the first to start the discussion.