Skip to main content
Glama
warrenzhu25

Dataproc MCP Server

by warrenzhu25

cancel_job

Stop a running Dataproc job by specifying project, region, and job ID to manage Google Cloud resources efficiently.

Instructions

Cancel a running job.

Args:
    project_id: Google Cloud project ID
    region: Dataproc region
    job_id: Job ID to cancel

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes
regionYes
job_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler and registration for cancel_job using @mcp.tool() decorator. Delegates to DataprocClient.cancel_job.
    @mcp.tool()
    async def cancel_job(project_id: str, region: str, job_id: str) -> str:
        """Cancel a running job.
    
        Args:
            project_id: Google Cloud project ID
            region: Dataproc region
            job_id: Job ID to cancel
        """
        client = DataprocClient()
        try:
            result = await client.cancel_job(project_id, region, job_id)
            return str(result)
        except Exception as e:
            logger.error("Failed to cancel job", error=str(e))
            return f"Error: {str(e)}"
  • DataprocClient method that performs the actual job cancellation using Google Cloud Dataproc API client.
    async def cancel_job(
        self, project_id: str, region: str, job_id: str
    ) -> dict[str, Any]:
        """Cancel a running job."""
        try:
            loop = asyncio.get_event_loop()
            client = self._get_job_client(region)
    
            request = types.CancelJobRequest(
                project_id=project_id, region=region, job_id=job_id
            )
    
            job = await loop.run_in_executor(None, client.cancel_job, request)
    
            return {
                "job_id": job.reference.job_id,
                "status": job.status.state.name,
                "message": f"Job {job_id} cancellation requested",
            }
    
        except Exception as e:
            logger.error("Failed to cancel job", 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 the basic action. It doesn't disclose behavioral traits like: whether cancellation is immediate or graceful, what permissions are required, if the job can be resumed, what happens to associated resources, or error conditions. For a destructive operation with zero annotation coverage, this is inadequate.

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

Conciseness5/5

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

The description is perfectly front-loaded with the core purpose in the first sentence, followed by a clean Args section. Every element earns its place with zero redundant information. The structure is logical and efficient.

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 this is a destructive operation with 3 parameters, no annotations, but with an output schema (which handles return values), the description is minimally complete. It covers purpose and parameters adequately but lacks important behavioral context about the cancellation process, permissions, and side effects that would be crucial for safe agent use.

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

Parameters4/5

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

Schema description coverage is 0%, but the description provides clear semantic meaning for all 3 parameters (project_id, region, job_id) in the Args section, mapping each to their Google Cloud/Dataproc context. This fully compensates for the schema's lack of descriptions, though it doesn't provide format examples or constraints.

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

Purpose5/5

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

The description clearly states the specific action ('Cancel') and target resource ('a running job'), distinguishing it from siblings like delete_batch_job (which likely removes completed/failed jobs) or submit_job (which starts jobs). The verb+resource combination is precise and unambiguous.

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

Usage Guidelines3/5

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

The description implies usage context by specifying 'a running job' (suggesting it's for active jobs only), but doesn't explicitly state when to use this vs. alternatives like delete_batch_job for completed jobs or compare_batch_jobs for analysis. No explicit exclusions or prerequisites are mentioned.

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