@@ -63,7 +63,7 @@ def _resolve_headers(headers: dict[str, str | Secret] | None) -> dict[str, str]
6363 return resolved_headers
6464
6565
66- def extract_first_text (result : str ) -> str :
66+ def extract_first_text_element (result : str ) -> str :
6767 # Per MCP spec, content[] may contain TextContent, ImageContent, AudioContent, etc.
6868 # Parse only first TextContent block (ToolInvoker requires dict, not list).
6969 parsed : dict = json .loads (result )
@@ -1103,7 +1103,7 @@ async def invoke() -> Any:
11031103 # Parse JSON to dict only when outputs_to_state is configured.
11041104 # ToolInvoker requires dict for _merge_tool_outputs(); ToolCallResult.result expects str otherwise.
11051105 if self .outputs_to_state :
1106- return self . extract_first_text (result )
1106+ return extract_first_text_element (result )
11071107
11081108 return result
11091109 except (MCPError , TimeoutError ) as e :
@@ -1134,7 +1134,7 @@ async def ainvoke(self, **kwargs: Any) -> str | dict[str, Any]:
11341134 # Parse JSON to dict only when outputs_to_state is configured.
11351135 # ToolInvoker requires dict for _merge_tool_outputs(); ToolCallResult.result expects str otherwise.
11361136 if self .outputs_to_state :
1137- return extract_first_text (result )
1137+ return extract_first_text_element (result )
11381138
11391139 return result
11401140 except asyncio .TimeoutError as e :
0 commit comments