cancel_flow_run
Stop an active workflow execution in Prefect by providing the flow run UUID to terminate the process and free up resources.
Instructions
Cancel a flow run.
Args: flow_run_id: The flow run UUID
Returns: Confirmation message
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| flow_run_id | Yes |
Implementation Reference
- src/mcp_prefect/flow_run.py:178-198 (handler)The handler function decorated with @mcp.tool that implements the cancel_flow_run tool by setting the flow run state to Cancelled using the Prefect client.@mcp.tool async def cancel_flow_run( flow_run_id: str, ) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]: """ Cancel a flow run. Args: flow_run_id: The flow run UUID Returns: Confirmation message """ async with get_client() as client: await client.set_flow_run_state( flow_run_id=UUID(flow_run_id), state=Cancelled(message="Cancelled via MCP") ) return [types.TextContent(type="text", text=f"Flow run '{flow_run_id}' cancelled successfully.")]