list_clusters
Retrieve and display Databricks clusters for monitoring and management, enabling users to view cluster metrics and configurations.
Instructions
List Clusters
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No |
Implementation Reference
- tools/compute.py:90-107 (handler)The `list_clusters` tool is defined in `tools/compute.py`. It uses `mcp.tool` for registration and `get_workspace_client` to retrieve cluster data from the Databricks SDK. It then formats the response into a list of dictionaries.
@mcp.tool def list_clusters(ctx: Context, limit: int = 20) -> List[Dict[str, Any]]: """List Clusters""" w = get_workspace_client() clusters = w.clusters.list() results = [] for i, c in enumerate(clusters): if i >= limit: break c_d = c.as_dict() results.append({ "cluster_id": c_d.get("cluster_id"), "cluster_name": c_d.get("cluster_name"), "state": c_d.get("state"), "driver_node_type_id": c_d.get("driver_node_type_id"), "spark_version": c_d.get("spark_version") }) return results