create_cluster
Set up a new Databricks cluster with custom parameters like cluster name, Spark version, node type, worker count, and auto-termination settings using Databricks MCP Server.
Instructions
Create a new Databricks cluster with parameters: cluster_name (required), spark_version (required), node_type_id (required), num_workers, autotermination_minutes
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Implementation Reference
- MCP tool handler for 'create_cluster'. This function is registered as an MCP tool using the @self.tool decorator and implements the tool logic by calling the underlying clusters.create_cluster API function, handling errors, and returning the result as TextContent.@self.tool( name="create_cluster", description="Create a new Databricks cluster with parameters: cluster_name (required), spark_version (required), node_type_id (required), num_workers, autotermination_minutes", ) async def create_cluster(params: Dict[str, Any]) -> List[TextContent]: logger.info(f"Creating cluster with params: {params}") try: result = await clusters.create_cluster(params) return [{"text": json.dumps(result)}] except Exception as e: logger.error(f"Error creating cluster: {str(e)}") return [{"text": json.dumps({"error": str(e)})}]
- src/api/clusters.py:14-28 (helper)Helper function that performs the actual Databricks API call to create a cluster. Called by the MCP tool handler.async def create_cluster(cluster_config: Dict[str, Any]) -> Dict[str, Any]: """ Create a new Databricks cluster. Args: cluster_config: Cluster configuration Returns: Response containing the cluster ID Raises: DatabricksAPIError: If the API request fails """ logger.info("Creating new cluster") return make_api_request("POST", "/api/2.0/clusters/create", data=cluster_config)
- src/server/databricks_mcp_server.py:63-66 (registration)Registration of the 'create_cluster' tool using the FastMCP @self.tool decorator, including name and description (serving as informal schema).@self.tool( name="create_cluster", description="Create a new Databricks cluster with parameters: cluster_name (required), spark_version (required), node_type_id (required), num_workers, autotermination_minutes", )