Skip to main content
Glama
warrenzhu25

Dataproc MCP Server

by warrenzhu25

list_batch_jobs

Retrieve and display Dataproc batch jobs from Google Cloud by specifying project ID and region. Supports pagination for managing large job lists.

Instructions

List Dataproc batch jobs.

Args:
    project_id: Google Cloud project ID
    region: Dataproc region
    page_size: Number of results per page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes
regionYes
page_sizeNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler for list_batch_jobs: decorated with @mcp.tool(), handles input parameters, instantiates DataprocBatchClient, calls its list_batch_jobs method, and returns stringified result or error.
    @mcp.tool()
    async def list_batch_jobs(project_id: str, region: str, page_size: int = 100) -> str:
        """List Dataproc batch jobs.
    
        Args:
            project_id: Google Cloud project ID
            region: Dataproc region
            page_size: Number of results per page
        """
        batch_client = DataprocBatchClient()
        try:
            result = await batch_client.list_batch_jobs(project_id, region, page_size)
            return str(result)
        except Exception as e:
            logger.error("Failed to list batch jobs", error=str(e))
            return f"Error: {str(e)}"
  • Core implementation of list_batch_jobs in DataprocBatchClient: uses Google Cloud Dataproc BatchControllerClient to list batches, extracts relevant info like batch_id, state, create_time, job_type, and returns structured dict.
    async def list_batch_jobs(
        self, project_id: str, region: str, page_size: int = 100
    ) -> dict[str, Any]:
        """List batch jobs."""
        try:
            loop = asyncio.get_event_loop()
            client = self._get_batch_client(region)
    
            request = types.ListBatchesRequest(
                parent=f"projects/{project_id}/locations/{region}", page_size=page_size
            )
    
            response = await loop.run_in_executor(None, client.list_batches, request)
    
            batches = []
            for batch in response:
                batches.append(
                    {
                        "batch_id": batch.name.split("/")[-1],
                        "state": batch.state.name,
                        "create_time": batch.create_time.isoformat()
                        if batch.create_time
                        else None,
                        "job_type": self._get_batch_job_type(batch),
                        "operation": batch.operation if batch.operation else None,
                    }
                )
    
            return {
                "batches": batches,
                "total_count": len(batches),
                "project_id": project_id,
                "region": region,
            }
    
        except Exception as e:
            logger.error("Failed to list batch 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 lacks behavioral details. It mentions pagination via 'page_size' but doesn't describe return format, rate limits, authentication needs, or whether it's read-only (implied but not stated). For a list operation with zero annotation coverage, this is insufficient.

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 concise with a clear purpose statement followed by parameter explanations. The structure is front-loaded with the main function, though the parameter section could be more integrated. No wasted sentences.

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 an output schema (which handles return values), the description covers basic purpose and parameters. However, for a list operation with no annotations and sibling tools, it lacks context on differentiation, behavioral traits, and usage guidelines, making it minimally adequate but incomplete.

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?

Schema description coverage is 0%, so the schema provides no parameter descriptions. The description adds basic semantics for all three parameters (project_id, region, page_size), explaining what they represent. However, it doesn't provide format details, constraints, or examples, leaving gaps in understanding.

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 verb 'List' and resource 'Dataproc batch jobs', making the purpose unambiguous. However, it doesn't differentiate from sibling tools like 'list_jobs' or 'list_clusters', which would require specifying what distinguishes batch jobs from other job types in Dataproc.

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 on when to use this tool versus alternatives like 'list_jobs', 'get_batch_job', or 'compare_batch_jobs'. The description only states what it does without context about appropriate use cases or exclusions.

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