Skip to main content
Glama
Unstructured-IO

Unstructured API MCP Server

Official

cancel_crawlhtml_job

Stop an active HTML crawl job in progress by specifying its unique crawl ID. This tool ensures the timely termination of Firecrawl operations within the Unstructured API MCP Server.

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

Implementation Reference

  • The handler function that cancels a Firecrawl HTML crawl job by delegating to the _cancel_job helper.
    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")
  • Registration of the cancel_crawlhtml_job tool using the mcp.tool() decorator within the external connectors registration function.
    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) # mcp.tool()(cancel_llmtxt_job) # currently commented till firecrawl brings up a cancel feature
  • Shared helper function that implements the cancellation logic for Firecrawl jobs using the FirecrawlApp client.
    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)}"}

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