Skip to main content
Glama
ChrisChoTW

databricks-mcp

by ChrisChoTW

get_cluster_events

Retrieve cluster event history including start, terminate, resize, and error events to monitor Databricks cluster activity and troubleshoot issues.

Instructions

Get cluster event history (start, terminate, resize, errors, etc.)

Args: cluster_id: Cluster ID limit: Max number of records to return

Returns: Event list (time in local timezone)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cluster_idYes
limitNo

Implementation Reference

  • Implementation of the get_cluster_events tool handler.
    def get_cluster_events(ctx: Context, cluster_id: str, limit: int = 20) -> List[Dict[str, Any]]:
        """
        Get cluster event history (start, terminate, resize, errors, etc.)
    
        Args:
            cluster_id: Cluster ID
            limit: Max number of records to return
    
        Returns:
            Event list (time in local timezone)
        """
        w = get_workspace_client()
        ctx.info(f"Querying cluster {cluster_id} events...")
    
        events_iter = w.clusters.events(cluster_id=cluster_id, limit=limit)
    
        results = []
        for event in events_iter:
            e = event.as_dict()
            ts = e.get("timestamp")
            if ts:
                local_time = datetime.utcfromtimestamp(ts / 1000) + timedelta(hours=8)
                time_str = local_time.strftime("%Y-%m-%d %H:%M:%S")
            else:
                time_str = None
    
            results.append({
                "time_local": time_str,
                "timestamp_ms": ts,
                "type": e.get("type"),
                "details": e.get("details")
            })
    
        return results
  • Registration of the get_cluster_events tool using the @mcp.tool decorator.
    @mcp.tool

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