Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/lfx/src/lfx/base/mcp/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1672,6 +1672,9 @@ async def run_tool(self, tool_name: str, arguments: dict[str, Any]) -> Any:
param_hash = uuid.uuid4().hex[:8]
self._session_context = f"default_{param_hash}"

# Tool-call timeout: env LANGFLOW_MCP_SERVER_TIMEOUT (via settings), with a 180s
# floor so default deployments aren't shorter than the previous hardcoded 30s.
timeout = max(get_settings_service().settings.mcp_server_timeout, 180.0)
max_retries = 2
last_error_type = None

Expand All @@ -1683,7 +1686,7 @@ async def run_tool(self, tool_name: str, arguments: dict[str, Any]) -> Any:

result = await asyncio.wait_for(
session.call_tool(tool_name, arguments=arguments),
timeout=30.0, # 30 second timeout
timeout=timeout,
)
except Exception as e:
current_error_type = type(e).__name__
Expand Down Expand Up @@ -1952,6 +1955,9 @@ async def run_tool(self, tool_name: str, arguments: dict[str, Any]) -> Any:
param_hash = uuid.uuid4().hex[:8]
self._session_context = f"default_http_{param_hash}"

# Tool-call timeout: env LANGFLOW_MCP_SERVER_TIMEOUT (via settings), with a 180s
# floor so default deployments aren't shorter than the previous hardcoded 30s.
timeout = max(get_settings_service().settings.mcp_server_timeout, 180.0)
max_retries = 2
last_error_type = None

Expand All @@ -1963,7 +1969,7 @@ async def run_tool(self, tool_name: str, arguments: dict[str, Any]) -> Any:

result = await asyncio.wait_for(
session.call_tool(tool_name, arguments=arguments),
timeout=30.0, # 30 second timeout
timeout=timeout,
)
except Exception as e:
current_error_type = type(e).__name__
Expand Down
Loading