From 33dca7b1a6af211bd2132281f7cb9a17b47b59a2 Mon Sep 17 00:00:00 2001 From: CI-DEV <154627941+IlumCI@users.noreply.github.com> Date: Mon, 4 Aug 2025 20:30:14 +0300 Subject: [PATCH] Update mcp_unified_client.py --- swarms/tools/mcp_unified_client.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/swarms/tools/mcp_unified_client.py b/swarms/tools/mcp_unified_client.py index 7758cc0c..37d9a6fd 100644 --- a/swarms/tools/mcp_unified_client.py +++ b/swarms/tools/mcp_unified_client.py @@ -28,7 +28,7 @@ import sys from concurrent.futures import ThreadPoolExecutor, as_completed from contextlib import asynccontextmanager from functools import wraps -from typing import Any, Dict, List, Literal, Optional, Union, AsyncGenerator +from typing import Any, Dict, List, Literal, Optional, Union, AsyncGenerator, Callable from urllib.parse import urlparse from loguru import logger @@ -140,6 +140,11 @@ class UnifiedTransportConfig(BaseModel): default=None, description="Timeout for streaming operations" ) + + streaming_callback: Optional[Callable[[str], None]] = Field( + default=None, + description="Optional callback function for streaming chunks" + ) class MCPUnifiedClient: @@ -760,4 +765,4 @@ async def example_unified_usage(): if __name__ == "__main__": # Run example - asyncio.run(example_unified_usage()) \ No newline at end of file + asyncio.run(example_unified_usage())