delete_flow
Remove a workflow from Prefect by specifying its unique identifier to declutter your automation environment and manage flow lifecycle.
Instructions
Delete a flow by ID.
Args: flow_id: The flow UUID
Returns: Confirmation message
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| flow_id | Yes |
Implementation Reference
- src/mcp_prefect/flow.py:127-158 (handler)The @mcp.tool decorated handler function for the 'delete_flow' tool. It validates the flow_id as UUID, deletes the flow using Prefect client, and returns success or error message.@mcp.tool async def delete_flow( flow_id: str, ) -> List[Union[types.TextContent, types.ImageContent, types.EmbeddedResource]]: """ Delete a flow by ID. Args: flow_id: The flow UUID Returns: Confirmation message """ try: async with get_client() as client: # Validate flow_id try: flow_uuid = UUID(flow_id) except ValueError: return [types.TextContent( type="text", text=f"Invalid flow ID format: {flow_id}. Must be a valid UUID." )] await client.delete_flow(flow_uuid) return [types.TextContent(type="text", text=f"Flow '{flow_id}' deleted successfully.")] except Exception as e: error_message = f"Error deleting flow {flow_id}: {str(e)}" return [types.TextContent(type="text", text=error_message)]