@@ -740,7 +740,7 @@ async def get_mcp_tools(
740740 server_label = mcp_server .name ,
741741 server_url = mcp_server .url ,
742742 require_approval = "never" ,
743- headers = headers if headers else None ,
743+ headers = headers or None ,
744744 authorization = authorization ,
745745 )
746746 )
@@ -801,7 +801,7 @@ def apply_mcp_headers_to_explicit_tools(
801801 out .append (
802802 mcp_tool .model_copy (
803803 update = {
804- "headers" : headers if headers else None ,
804+ "headers" : headers or None ,
805805 "authorization" : authorization ,
806806 }
807807 )
@@ -861,7 +861,7 @@ def parse_referenced_documents( # pylint: disable=too-many-locals
861861
862862 if doc_title or doc_url :
863863 # Treat empty string as None for URL to satisfy Optional[AnyUrl]
864- final_url = doc_url if doc_url else None
864+ final_url = doc_url or None
865865 if (final_url , doc_title ) not in seen_docs :
866866 documents .append (
867867 ReferencedDocument (
@@ -1018,11 +1018,7 @@ def build_tool_call_summary( # pylint: disable=too-many-return-statements,too-m
10181018 args = parse_arguments_string (mcp_call_item .arguments )
10191019 if mcp_call_item .server_label :
10201020 args ["server_label" ] = mcp_call_item .server_label
1021- content = (
1022- mcp_call_item .error
1023- if mcp_call_item .error
1024- else (mcp_call_item .output if mcp_call_item .output else "" )
1025- )
1021+ content = mcp_call_item .error or (mcp_call_item .output or "" )
10261022
10271023 return ToolCallSummary (
10281024 id = mcp_call_item .id ,
@@ -1141,11 +1137,7 @@ def build_tool_result_from_mcp_output_item_done(
11411137 Returns:
11421138 ToolResultSummary for the MCP call
11431139 """
1144- content = (
1145- output_item .error
1146- if output_item .error
1147- else (output_item .output if output_item .output else "" )
1148- )
1140+ content = output_item .error or (output_item .output or "" )
11491141 return ToolResultSummary (
11501142 id = output_item .id ,
11511143 status = "success" if output_item .error is None else "failure" ,
@@ -1213,7 +1205,7 @@ def _build_chunk_attributes(result: Any) -> Optional[dict[str, Any]]:
12131205 if not attributes :
12141206 return None
12151207 if isinstance (attributes , dict ):
1216- return attributes if attributes else None
1208+ return attributes or None
12171209 return None
12181210
12191211
0 commit comments