list_clusters
Retrieve a comprehensive list of all Databricks clusters to manage and monitor resources effectively using the Databricks MCP Server.
Instructions
List all Databricks clusters
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Implementation Reference
- MCP tool handler for 'list_clusters': registers the tool and implements the logic by calling the clusters.list_clusters API function, formatting the response as TextContent.@self.tool( name="list_clusters", description="List all Databricks clusters", ) async def list_clusters(params: Dict[str, Any]) -> List[TextContent]: logger.info(f"Listing clusters with params: {params}") try: result = await clusters.list_clusters() return [{"text": json.dumps(result)}] except Exception as e: logger.error(f"Error listing clusters: {str(e)}") return [{"text": json.dumps({"error": str(e)})}]
- src/api/clusters.py:48-59 (helper)Core API helper function list_clusters() that makes a GET request to Databricks /api/2.0/clusters/list endpoint.async def list_clusters() -> Dict[str, Any]: """ List all Databricks clusters. Returns: Response containing a list of clusters Raises: DatabricksAPIError: If the API request fails """ logger.info("Listing all clusters") return make_api_request("GET", "/api/2.0/clusters/list")
- src/server/databricks_mcp_server.py:50-53 (registration)Registration of the 'list_clusters' tool using FastMCP @self.tool decorator.@self.tool( name="list_clusters", description="List all Databricks clusters", )