Skip to main content
Glama
Unstructured-IO

Unstructured API MCP Server

Official

cancel_crawlhtml_job

Stop an active HTML crawl job in the Unstructured API MCP Server by providing its crawl ID to halt processing and manage resources.

Instructions

Cancel an in-progress Firecrawl HTML crawl job.

Args:
    crawl_id: ID of the crawl job to cancel

Returns:
    Dictionary containing the result of the cancellation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
crawl_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'cancel_crawlhtml_job' MCP tool. It takes a crawl_id and delegates to the internal _cancel_job helper to perform the cancellation via the Firecrawl API.
    async def cancel_crawlhtml_job(
        crawl_id: str,
    ) -> Dict[str, Any]:
        """Cancel an in-progress Firecrawl HTML crawl job.
    
        Args:
            crawl_id: ID of the crawl job to cancel
    
        Returns:
            Dictionary containing the result of the cancellation
        """
        return await _cancel_job(crawl_id, "crawlhtml")
  • Internal helper function that performs the actual cancellation logic for Firecrawl jobs, handling API key setup, client initialization, cancellation call, and error handling. Used by cancel_crawlhtml_job.
    async def _cancel_job(
        job_id: str,
        job_type: Firecrawl_JobType,
    ) -> Dict[str, Any]:
        """Generic function to cancel a Firecrawl job.
    
        Args:
            job_id: ID of the job to cancel
            job_type: Type of job ('crawlhtml' or 'llmtxt')
    
        Returns:
            Dictionary containing the result of the cancellation
        """
        # Get configuration with API key
        config = _prepare_firecrawl_config()
    
        # Check if config contains an error
        if "error" in config:
            return {"error": config["error"]}
    
        # Special case for LLM text generation jobs - not supported
        if job_type == "llmfulltxt":
            return {
                "id": job_id,
                "status": "error",
                "message": (
                    "Cancelling LLM text generation jobs is not supported." " The job must complete."
                ),
                "details": {"status": "error", "reason": "unsupported_operation"},
            }
        else:
            try:
                # Initialize the Firecrawl client
                firecrawl = FirecrawlApp(api_key=config["api_key"])
    
                # Cancel the job
                result = firecrawl.cancel_crawl(job_id)
    
                # Check if the cancellation was successful (result has 'status': 'cancelled')
                is_successful = result.get("status") == "cancelled"
    
                # Return a user-friendly response
                return {
                    "id": job_id,
                    "status": "cancelled" if is_successful else "error",
                    "message": f"Firecrawl {job_type} job cancelled successfully"
                    if is_successful
                    else "Failed to cancel job",
                    "details": result,
                }
            except Exception as e:
                return {"error": f"Error cancelling {job_type} job: {str(e)}"}
  • Imports the cancel_crawlhtml_job function from firecrawl.py and registers it as an MCP tool using mcp.tool() within the register_external_connectors function.
    from .firecrawl import (
        cancel_crawlhtml_job,
        check_crawlhtml_status,
        check_llmtxt_status,
        invoke_firecrawl_crawlhtml,
        invoke_firecrawl_llmtxt,
    )
    
    mcp.tool()(invoke_firecrawl_crawlhtml)
    mcp.tool()(check_crawlhtml_status)
    mcp.tool()(invoke_firecrawl_llmtxt)
    mcp.tool()(check_llmtxt_status)
    mcp.tool()(cancel_crawlhtml_job)
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While it states the tool cancels jobs and returns a dictionary result, it lacks critical details: what permissions are needed, whether cancellation is reversible, potential side effects (e.g., partial data cleanup), rate limits, or error conditions. For a mutation tool with zero annotation coverage, this is a significant gap.

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 three sentences: purpose statement, parameter explanation, and return value note. It's front-loaded with the core functionality. The structure is clear, though the 'Args' and 'Returns' sections could be integrated more smoothly into prose.

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's complexity (mutation with 1 parameter), lack of annotations, and presence of an output schema, the description is minimally adequate. The output schema reduces the need to detail return values, but the description misses behavioral context (e.g., cancellation effects) and usage guidelines. It covers basics but leaves gaps for safe and effective use.

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 description must compensate. It documents the single parameter 'crawl_id' with a brief explanation ('ID of the crawl job to cancel'), which adds basic meaning beyond the schema's title 'Crawl Id'. However, it doesn't provide format examples, validation rules, or where to obtain the ID, leaving the parameter only partially clarified.

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 tool's purpose: 'Cancel an in-progress Firecrawl HTML crawl job.' It specifies the verb ('cancel'), resource ('Firecrawl HTML crawl job'), and scope ('in-progress'). However, it doesn't explicitly differentiate from sibling tools like 'cancel_job' or 'check_crawlhtml_status', which could create ambiguity about when to use this specific tool versus alternatives.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., job must be in-progress), exclusions (e.g., cannot cancel completed jobs), or comparisons to sibling tools like 'cancel_job' or 'check_crawlhtml_status'. This leaves the agent without context for tool selection.

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/Unstructured-IO/UNS-MCP'

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