list_clusters
Retrieve a detailed list of all Databricks clusters for efficient management and monitoring using natural language commands.
Instructions
List all Databricks clusters
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The MCP tool handler for 'list_clusters'. Decorated with @mcp.tool() which handles registration and schema generation from types/docstring. Delegates to clusters.list_clusters() API wrapper and returns JSON.@mcp.tool() async def list_clusters() -> str: """List all Databricks clusters""" logger.info("Listing clusters") try: result = await clusters.list_clusters() return json.dumps(result) except Exception as e: logger.error(f"Error listing clusters: {str(e)}") return json.dumps({"error": str(e)})
- src/api/clusters.py:48-60 (helper)Core helper function implementing the Databricks Clusters API list call via make_api_request to /api/2.0/clusters/list.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")