get_flow_by_id
Retrieve a specific workflow by its unique ID using the Prefect MCP Server, enabling efficient management and tracking of automated workflows.
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)The handler function decorated with @mcp.tool() that implements the 'get_flow_by_id' tool. It retrieves a Prefect flow by its ID using the Prefect client, handles errors, and returns the flow data or an error message.@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)}"}