Skip to main content
Glama
JustTryAI

Databricks MCP Server

terminate_cluster

Stop and decommission a Databricks cluster using its cluster ID to manage resources and control costs.

Instructions

Terminate a Databricks cluster with parameter: cluster_id (required)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Implementation Reference

  • Core handler implementing the cluster termination logic by calling the Databricks Clusters API delete endpoint.
    async def terminate_cluster(cluster_id: str) -> Dict[str, Any]:
        """
        Terminate a Databricks cluster.
        
        Args:
            cluster_id: ID of the cluster to terminate
            
        Returns:
            Empty response on success
            
        Raises:
            DatabricksAPIError: If the API request fails
        """
        logger.info(f"Terminating cluster: {cluster_id}")
        return make_api_request("POST", "/api/2.0/clusters/delete", data={"cluster_id": cluster_id})
  • MCP tool registration and wrapper handler that registers the 'terminate_cluster' tool and delegates to the core API handler.
    @self.tool(
        name="terminate_cluster",
        description="Terminate a Databricks cluster with parameter: cluster_id (required)",
    )
    async def terminate_cluster(params: Dict[str, Any]) -> List[TextContent]:
        logger.info(f"Terminating cluster with params: {params}")
        try:
            result = await clusters.terminate_cluster(params.get("cluster_id"))
            return [{"text": json.dumps(result)}]
        except Exception as e:
            logger.error(f"Error terminating cluster: {str(e)}")
            return [{"text": json.dumps({"error": str(e)})}]
  • FastAPI endpoint handler for cluster termination (compatibility stub).
    async def terminate_cluster(request_data: dict):
        """Terminate a cluster."""
        result = await clusters.terminate_cluster(request_data.get("cluster_id"))
        return result

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/JustTryAI/databricks-mcp-server'

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