get_flow_by_id
Retrieve a specific workflow automation flow using its unique identifier to access and manage Prefect workflow details.
Instructions
Get a flow by its ID.
Args:
flow_id: ID of the flow to retrieve.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| flow_id | Yes |
Implementation Reference
- prefect_mcp_server_pkg/server.py:56-72 (handler)Handler function that implements the get_flow_by_id tool logic. Retrieves a Prefect flow by its ID using the Prefect client and returns the flow details or an error.@mcp.tool() async def get_flow_by_id(ctx: Context, flow_id: str) -> Dict[str, Any]: """Get a flow by its ID. Args: flow_id: ID of the flow to retrieve. """ if not flow_id: return {"error": "Missing required argument: flow_id"} async with get_client() as client: try: flow = await client.read_flow(UUID(flow_id)) return {"flow": flow.model_dump()} except Exception as e: return {"error": f"Failed to get flow: {str(e)}"}