execute_sql
Execute SQL commands (SELECT, DDL, DML) on a Fabric Warehouse or SQL Analytics Endpoint. Returns structured results with truncation detection.
Instructions
Execute an arbitrary SQL statement or batch against a warehouse or SQL Analytics Endpoint.
WARNING: this tool executes arbitrary SQL against the target. DDL (DROP,
ALTER, TRUNCATE) and DML (DELETE, UPDATE) are permitted unless
FABRIC_MCP_READONLY=1 is set. Use only when the user explicitly
requests data modification. Default to SELECT when the user's intent is
read-only investigation.
Supports both Warehouse and SQL Analytics Endpoint items. Multi-statement
batches are allowed; only the last result set is returned. DDL/DML
statements that produce no result set return columns=[] and rows=[].
datetime and Decimal column values are pre-serialised to strings.
bytes / varbinary columns are base64-encoded and their column names are
suffixed with __base64.
For large tables, add a TOP clause or WHERE predicate to the query rather
than relying solely on max_rows. The driver fetches at most
max_rows + 1 rows (enough to detect truncation) so memory is bounded,
but pushing the limit into the query itself is always more efficient.
Args:
workspace: Workspace name or GUID.
item: Warehouse or SQL Analytics Endpoint name or GUID.
query: SQL statement or batch to execute.
max_rows: Maximum rows to return (1-10000, default 1000). When the
result set is larger the response includes "truncated": true.
Returns:
A dict with keys columns (list[str]), rows (list[list[Any]]),
rowcount (int; -1 when the driver does not report a count),
row_count_returned (int), and truncated (bool).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workspace | Yes | ||
| item | Yes | ||
| query | Yes | ||
| max_rows | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||