Skip to main content
Glama
warrenzhu25

Dataproc MCP Server

by warrenzhu25

list_jobs

Retrieve and filter Dataproc job listings by project, region, cluster, and state to monitor and manage data processing workflows.

Instructions

List jobs in a Dataproc cluster.

Args:
    project_id: Google Cloud project ID
    region: Dataproc region
    cluster_name: Cluster name (optional)
    job_states: Filter by job states

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes
regionYes
cluster_nameNo
job_statesNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The primary MCP tool handler for 'list_jobs', registered via @mcp.tool() decorator. It invokes the DataprocClient's list_jobs method and handles errors.
    @mcp.tool()
    async def list_jobs(
        project_id: str,
        region: str,
        cluster_name: str | None = None,
        job_states: list[str] | None = None,
    ) -> str:
        """List jobs in a Dataproc cluster.
    
        Args:
            project_id: Google Cloud project ID
            region: Dataproc region
            cluster_name: Cluster name (optional)
            job_states: Filter by job states
        """
        client = DataprocClient()
        try:
            result = await client.list_jobs(
                project_id=project_id,
                region=region,
                cluster_name=cluster_name,
                job_states=job_states or [],
            )
            return str(result)
        except Exception as e:
            logger.error("Failed to list jobs", error=str(e))
            return f"Error: {str(e)}"
  • Supporting helper function in DataprocClient that performs the actual Google Cloud API call to list jobs, applies filtering, and formats the response.
    async def list_jobs(
        self,
        project_id: str,
        region: str,
        cluster_name: str | None = None,
        job_states: list[str] | None = None,
    ) -> dict[str, Any]:
        """List jobs in a region."""
        try:
            loop = asyncio.get_event_loop()
            client = self._get_job_client(region)
    
            request = types.ListJobsRequest(
                project_id=project_id,
                region=region,
                cluster_name=cluster_name,
                job_state_matcher=types.ListJobsRequest.StateMatcherType.ALL,
            )
    
            response = await loop.run_in_executor(None, client.list_jobs, request)
    
            jobs = []
            for job in response:
                # Filter by states if provided
                if job_states and job.status.state.name not in job_states:
                    continue
    
                jobs.append(
                    {
                        "job_id": job.reference.job_id,
                        "cluster_name": job.placement.cluster_name,
                        "status": job.status.state.name,
                        "job_type": self._get_job_type(job),
                        "submission_time": job.status.state_start_time.isoformat()
                        if job.status.state_start_time
                        else None,
                        "driver_output_uri": job.driver_output_resource_uri,
                    }
                )
    
            return {
                "jobs": jobs,
                "total_count": len(jobs),
                "project_id": project_id,
                "region": region,
                "cluster_name": cluster_name,
            }
    
        except Exception as e:
            logger.error("Failed to list jobs", error=str(e))
            raise
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but only states it's a listing operation. It doesn't disclose behavioral traits like pagination, rate limits, authentication requirements, error conditions, or what happens when optional parameters are omitted. The mention of filtering is minimal and lacks operational context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized with a clear opening sentence followed by a parameter list. The structure is front-loaded with the core purpose first. However, the parameter explanations are very brief and could be more informative without sacrificing conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 4 parameters, no annotations, but an output schema exists, the description is minimally adequate. It covers the basic purpose and parameters but lacks context about filtering behavior, alternatives, and operational constraints. The output schema reduces the need to describe return values, but more behavioral context would improve completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description lists all 4 parameters with brief explanations, but with 0% schema description coverage, it doesn't fully compensate. It provides basic meaning (e.g., 'Google Cloud project ID') but lacks details like format constraints, valid job states, or how cluster_name affects results. The schema already defines types and requirements, so this adds marginal value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('List jobs') and resource ('in a Dataproc cluster'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'list_batch_jobs' or 'get_job', which would require more specific scope or filtering details.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided about when to use this tool versus alternatives like 'list_batch_jobs' or 'get_job'. The description mentions optional filtering by cluster and job states, but doesn't explain when these filters are appropriate or what happens without them.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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