@@ -3547,10 +3547,7 @@ def _validate_tools(self, tools: list[dict[str, Any]], context: str = "default")
35473547 validation_errors .append (error_msg )
35483548 except ValueError as e :
35493549 if "JSON structure exceeds maximum depth" in str (e ):
3550- error_msg = (
3551- f"Tool '{ tool_name } ' schema too deeply nested. "
3552- f"Current depth limit: { settings .validation_max_json_depth } "
3553- )
3550+ error_msg = f"Tool '{ tool_name } ' schema too deeply nested. " f"Current depth limit: { settings .validation_max_json_depth } "
35543551 logger .error (error_msg )
35553552 logger .warning ("Consider increasing VALIDATION_MAX_JSON_DEPTH environment variable" )
35563553 else :
@@ -3563,23 +3560,14 @@ def _validate_tools(self, tools: list[dict[str, Any]], context: str = "default")
35633560 validation_errors .append (error_msg )
35643561
35653562 if validation_errors :
3566- logger .warning (
3567- f"Tool validation completed with { len (validation_errors )} error(s). "
3568- f"Successfully validated { len (valid_tools )} tool(s)."
3569- )
3563+ logger .warning (f"Tool validation completed with { len (validation_errors )} error(s). " f"Successfully validated { len (valid_tools )} tool(s)." )
35703564 for err in validation_errors [:3 ]:
35713565 logger .debug (f"Validation error: { err } " )
35723566
35733567 if not valid_tools and validation_errors :
35743568 if context == "oauth" :
3575- raise OAuthToolValidationError (
3576- f"OAuth tool fetch failed: all { len (tools )} tools failed validation. "
3577- f"First error: { validation_errors [0 ][:200 ]} "
3578- )
3579- raise GatewayConnectionError (
3580- f"Failed to fetch tools: All { len (tools )} tools failed validation. "
3581- f"First error: { validation_errors [0 ][:200 ]} "
3582- )
3569+ raise OAuthToolValidationError (f"OAuth tool fetch failed: all { len (tools )} tools failed validation. " f"First error: { validation_errors [0 ][:200 ]} " )
3570+ raise GatewayConnectionError (f"Failed to fetch tools: All { len (tools )} tools failed validation. " f"First error: { validation_errors [0 ][:200 ]} " )
35833571
35843572 return valid_tools
35853573
@@ -3610,9 +3598,7 @@ async def _connect_to_sse_server_without_validation(self, server_url: str, authe
36103598
36113599 response = await session .list_tools ()
36123600 tools = response .tools
3613- tools = [
3614- tool .model_dump (by_alias = True , exclude_none = True , exclude_unset = True ) for tool in tools
3615- ]
3601+ tools = [tool .model_dump (by_alias = True , exclude_none = True , exclude_unset = True ) for tool in tools ]
36163602
36173603 tools = self ._validate_tools (tools , context = "oauth" )
36183604 if tools :
@@ -3755,9 +3741,7 @@ def get_httpx_client_factory(
37553741
37563742 response = await session .list_tools ()
37573743 tools = response .tools
3758- tools = [
3759- tool .model_dump (by_alias = True , exclude_none = True , exclude_unset = True ) for tool in tools
3760- ]
3744+ tools = [tool .model_dump (by_alias = True , exclude_none = True , exclude_unset = True ) for tool in tools ]
37613745
37623746 tools = self ._validate_tools (tools )
37633747 if tools :
@@ -3897,9 +3881,7 @@ def get_httpx_client_factory(
38973881
38983882 response = await session .list_tools ()
38993883 tools = response .tools
3900- tools = [
3901- tool .model_dump (by_alias = True , exclude_none = True , exclude_unset = True ) for tool in tools
3902- ]
3884+ tools = [tool .model_dump (by_alias = True , exclude_none = True , exclude_unset = True ) for tool in tools ]
39033885
39043886 tools = self ._validate_tools (tools )
39053887 for tool in tools :
0 commit comments