Data
Query Tools (Preview)
is a server feature on the Business Central MCP server. Switch it on and an
agent gets four system tools: it can search your tables, read their fields and
relations, write an AL query, have Business Central compile it, and run it.
What makes
it useful is what it removes. Until now an agent could only read what an admin
had published as an API page or API query, so anything else meant a development
request and a deployment. With the data query tools, an agent can answer a
question nobody built an object for, which describes most ad hoc analysis. The
boundaries become the permissions the signed-in user already has and what an AL
query can express. It is read-only, so nothing can be created, changed or
deleted through it.
This guide
takes you from nothing to a working.
Before
you start
- A Business Central online sandbox
on a version that has the Data Query Tools server feature. It shipped as a
preview in 2026 release wave 2.
- The MCP - ADMIN
permission set, or equivalent, to create MCP configurations.
- Visual Studio Code with the
GitHub Copilot extension.
- Your Microsoft Entra tenant ID, environment name, and company name.
Step 1:
create an MCP server configuration
1.
In
Business Central, search for and open Model Context Protocol (MCP) Server
Configurations. The direct page is 8351.
2.
Select
New.
3.
Set
Name to something you will recognise in telemetry later. DataQueryTest works,
and you will see that exact string in the configurationName dimension in step
9.
4. Set Description to whatever you like.
Leave Unblock
Edit Tools off. You are testing read-only analysis, and there is no reason
to hand write access to an agent while you do it.
Step 2:
turn on the data query tools
1.
Find
the Server Features section on the configuration.
2.
Enable
Data Query Tools (Preview).
3.
Look
at the system tools box next to it. It lists the tools this feature unlocks. If
you enable more than one server feature, the box shows the combined set.
You should
see four tools appear:
|
Tool |
What it does |
|
bc_data_find_tables |
Finds tables by name or semantic
similarity, returns table IDs and names |
|
bc_data_get_table_schema |
Returns the fields on a table |
|
bc_data_get_table_relations |
Returns incoming or outgoing
relations for a table |
|
bc_data_query |
Compiles and validates an AL query.
Returns schema only unless returnData is true |
That is the
whole configuration for this test. You do not need to add a single API page.
That is the point of the feature.
Turn Active on.
Step 3:
copy the connection string
1.
With
the configuration open, select Advanced then Connection String.
2.
Copy
the JSON, or select Download to save it as a text file.
It looks
like this:
"businesscentral":
{
"url":
"https://mcp.businesscentral.dynamics.com",
"type": "http",
"headers": {
"TenantId":
"aaaabbbb-0000-cccc-1111-dddd2222eeee",
"EnvironmentName":
"Sandbox",
"Company": "CRONUS USA,
Inc.",
"ConfigurationName":
"DataQueryTest"
}
}
Step 4:
add the server to VS Code
1.
Open
VS Code on a folder you can keep. You will be saving .al files here later.
2.
Create
.vscode/mcp.json if it does not exist.
3.
Paste
the connection string inside the servers element:
{
"servers": {
"businesscentral": {
"url":
"https://mcp.businesscentral.dynamics.com",
"type": "http",
"headers": {
"TenantId":
"aaaabbbb-0000-cccc-1111-dddd2222eeee",
"EnvironmentName":
"Sandbox",
"Company": "CRONUS USA,
Inc.",
"ConfigurationName":
"DataQueryTest"
}
}
}
}
4.
Save.
A small toolbar appears above the server entry in the file. Select Start.
5.
Sign
in when prompted. Authentication is OAuth 2.0 against Microsoft Entra
ID, and VS Code uses a preregistered application, so there is nothing to
register yourself.
6.
The
toolbar text changes to Running.
If you are testing from Claude, ChatGPT, or GitHub Copilot CLI instead, you point at the same URL but you have to register your own Entra application first. The Learn article on non-Microsoft hosts covers that.
What a
healthy start looks like
Open the Output
panel and pick the channel for your MCP server. A good run reads like this:
[info]
Starting server businesscentral
[info]
Connection state: Running
[info]
Discovered 4 tools
The line that actually matters is the last one. Discovered 4 tools means the data query tools came through.
Step 5:
confirm the four tools are really there
This is the
step people skip, and then they spend twenty minutes wondering why the agent
keeps reaching for an API tool.
- Open GitHub Copilot Chat in Agent
mode with Ctrl+Shift+I.
- Type # in the chat input. That
lists every available tool by name, so typing #bc_data filters straight to
the four you care about.
The mcp.json code lens is the quickest sanity check of all. Once the server is running, it shows the tool count above the server entry, which is where the Discovered 4 tools figure from step 4 comes from.
Step 6: smoke test, one tool at a time
Run these
three prompts before anything ambitious. Each one is designed to force a single
tool, so when something breaks you know exactly what broke.
Prompt 1,
discovery:
Using only the Business Central data tools, find tables related to item ledger entries. List the table IDs and names you get back. Do not write a query yet.
Expect a
call to bc_data_find_tables and a list including table 32, Item Ledger Entry.
If you get an apology about not having access to Business Central, the server
is not running or the tools are not available.
Prompt 2, schema:
Get the schema for the Value Entry table and show me every field whose name contains "Amount".
Expect
bc_data_get_table_schema and a field list including Sales Amount (Actual) and
Cost Amount (Actual). This also tells you whether the tool returns data types,
which the model needs, because aggregates other than Count only work on
Decimal, Integer, BigInteger or Duration fields.
Prompt 3,
compile without running:
Write an AL query that returns the No. and Name of the Customer table, compile it with the data query tool, but do not return any rows.
Expect
bc_data_query with returnData absent or false, and a schema back rather than
rows. This proves the compile path works in isolation, which is the single most
useful thing to know before you start debugging a complicated query.
If all three
pass, the plumbing is good.
Now go
break it
That is the
setup done. Six steps, one configuration, no API pages, and an agent that can
read your Business Central data by writing AL on the fly.







