Skip to main content
Glama

get_cluster

Retrieve specific details about a Dataproc cluster by providing the Google Cloud project ID, region, and cluster name. Simplify cluster management and monitoring for efficient cloud operations.

Instructions

Get details of a specific Dataproc cluster.

Args: project_id: Google Cloud project ID region: Dataproc region cluster_name: Name of the cluster

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cluster_nameYes
project_idYes
regionYes

Implementation Reference

  • MCP tool handler for get_cluster, registered via @mcp.tool() decorator. Handles input validation implicitly via type hints, resolves defaults, delegates to DataprocClient.get_cluster(), and formats response.
    @mcp.tool() async def get_cluster( cluster_name: str, project_id: str | None = None, region: str | None = None ) -> str: """Get details of a specific Dataproc cluster. Args: cluster_name: Name of the cluster project_id: Google Cloud project ID (optional, uses gcloud config default) region: Dataproc region (optional, uses gcloud config default) """ resolved = resolve_project_and_region(project_id, region) if isinstance(resolved, str): # Error message return resolved project_id, region = resolved client = DataprocClient() try: result = await client.get_cluster(project_id, region, cluster_name) return str(result) except Exception as e: logger.error("Failed to get cluster", error=str(e)) return f"Error: {str(e)}"
  • Supporting method in DataprocClient that performs the actual Google Cloud Dataproc API call to retrieve and format cluster details.
    async def get_cluster( self, project_id: str, region: str, cluster_name: str ) -> dict[str, Any]: """Get details of a specific cluster.""" try: loop = asyncio.get_event_loop() client = self._get_cluster_client(region) request = types.GetClusterRequest( project_id=project_id, region=region, cluster_name=cluster_name ) cluster = await loop.run_in_executor(None, client.get_cluster, request) return { "name": cluster.cluster_name, "status": cluster.status.state.name, "status_detail": cluster.status.detail, "num_instances": cluster.config.worker_config.num_instances, "master_machine_type": cluster.config.master_config.machine_type_uri.split( "/" )[-1], "worker_machine_type": cluster.config.worker_config.machine_type_uri.split( "/" )[-1], "disk_size_gb": cluster.config.master_config.disk_config.boot_disk_size_gb, "image_version": cluster.config.software_config.image_version, "creation_time": cluster.status.state_start_time.isoformat() if cluster.status.state_start_time else None, "zone": cluster.config.gce_cluster_config.zone_uri.split("/")[-1] if cluster.config.gce_cluster_config.zone_uri else None, "metrics": { "hdfs_capacity_mb": getattr( cluster.metrics.hdfs_metrics, "capacity_mb", None ) if cluster.metrics and cluster.metrics.hdfs_metrics else None, "yarn_allocated_memory_mb": getattr( cluster.metrics.yarn_metrics, "allocated_memory_mb", None ) if cluster.metrics and cluster.metrics.yarn_metrics else None, }, } except Exception as e: logger.error("Failed to get cluster", error=str(e)) raise

Other Tools

Related Tools

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/warrenzhu25/dataproc-mcp'

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