cancel_job
Terminate a specific job by its ID using this tool, which removes the job from the Unstructured API MCP Server and returns the cancellation response.
Instructions
Delete a specific job.
Args:
job_id: ID of the job to cancel
Returns:
String containing the response from the job cancellation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| job_id | Yes |
Implementation Reference
- uns_mcp/server.py:540-559 (handler)The primary MCP tool handler for 'cancel_job'. It uses the UnstructuredClient to cancel a job by ID and returns a success or error message.@mcp.tool() async def cancel_job(ctx: Context, job_id: str) -> str: """Delete a specific job. Args: job_id: ID of the job to cancel Returns: String containing the response from the job cancellation """ client = ctx.request_context.lifespan_context.client try: response = await client.jobs.cancel_job_async( request=CancelJobRequest(job_id=job_id), ) return f"Job canceled successfully: {response.raw_response}" except Exception as e: return f"Error canceling job: {str(e)}"
- uns_mcp/server.py:22-22 (schema)Import of CancelJobRequest model used in the cancel_job handler for request validation.CancelJobRequest,
- uns_mcp/server.py:540-540 (registration)The @mcp.tool() decorator registers the cancel_job function as an MCP tool.@mcp.tool()