mcp_cancel_job
Cancel long-running MCP jobs like ETCH or NEXUS operations in the WorkFlowy MCP Server by providing the job ID to stop ongoing processes.
Instructions
Request cancellation of a long-running MCP job (ETCH, NEXUS, etc.).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| job_id | Yes |
Implementation Reference
- src/workflowy_mcp/server.py:836-863 (handler)The handler function for the 'mcp_cancel_job' tool. It retrieves the job from the in-memory registry, checks if it's cancellable, marks it as cancelling, and cancels the associated asyncio task.@mcp.tool( name="mcp_cancel_job", description="Request cancellation of a long-running MCP job (ETCH, NEXUS, etc.).", ) async def mcp_cancel_job(job_id: str) -> dict: """Attempt to cancel a background MCP job. This sends an asyncio.CancelledError into the job task. The job will transition to status='failed' with an error message indicating cancellation. """ job = _jobs.get(job_id) if not job: return {"success": False, "error": f"Unknown job_id: {job_id}"} task = job.get("_task") if task is None: return {"success": False, "error": "Job has no associated task (cannot cancel)."} if task.done(): return {"success": False, "error": "Job already completed."} # Mark as cancelling for visibility; runner will finalize status job["status"] = "cancelling" task.cancel() return {"success": True, "job_id": job_id, "status": "cancelling"}