Skip to main content
Glama
ChrisChoTW

databricks-mcp

by ChrisChoTW

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
NameRequiredDescriptionDefault
limitNo

Implementation Reference

  • 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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ChrisChoTW/databricks-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server