Execute code
execute_codeRun Python, SQL, Scala, or R code on Databricks clusters or serverless compute, then get status or cancel pending executions and return results.
Instructions
Execute Python, SQL, Scala or R code on Databricks compute and return its output.
run (code, language[, compute, cluster_id, timeout_seconds]): on a RUNNING classic cluster via the Command Execution API (a fresh execution context per call; no state is kept between calls), or, for Python, on serverless jobs compute (temporary notebook in ~/.dbx_mcp/tmp, one-time run; stdout/stderr captured). Returns status success/failed with output (text or table rows/columns) and error summary/stack trace, and which compute was used. If not finished within timeout_seconds it returns status 'pending' with ids to poll.
get_status (cluster_id+context_id+command_id, or run_id): poll a pending execution.
cancel (same ids): stop a pending execution. For SQL on a SQL warehouse prefer execute_sql. Classified EXECUTION: code can change data and costs money.
Safety classification: depends on input (EXECUTION, READ_ONLY, WRITE).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | run: the code to execute. | |
| action | No | run: execute code; get_status: poll a pending execution; cancel: stop it. | run |
| run_id | No | get_status/cancel (serverless): run id. | |
| compute | No | run: 'cluster' (classic all-purpose cluster; any language) or 'serverless' (Python only, one-time serverless job run; slower to start). | cluster |
| confirm | No | Set to true ONLY after the user has reviewed the plan returned by a previous call with status 'confirmation_required'. Required for destructive/security-sensitive actions. | |
| dry_run | No | If true, validate and return the planned change without executing it. | |
| language | No | run: code language. | python |
| cluster_id | No | Cluster id (default DBX_MCP_DEFAULT_CLUSTER_ID); also for get_status/cancel. | |
| command_id | No | get_status/cancel (cluster): command id. | |
| context_id | No | get_status/cancel (cluster): execution context id. | |
| timeout_seconds | No | run: max seconds to wait before returning 'pending' (capped by server). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | No | ||
| page | No | ||
| plan | No | ||
| tool | Yes | ||
| action | No | ||
| safety | No | ||
| status | No | success | |
| summary | Yes | ||
| warnings | No | ||
| next_steps | No | Suggested follow-up calls. | |
| request_id | No |