File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -328,23 +328,25 @@ async def _execute_tool_and_respond(
328328 if inspect .isawaitable (result ):
329329 result = await result
330330
331+ tool_result : ToolResult
331332 if result is None :
332- result = ToolResult (
333+ tool_result = ToolResult (
333334 text_result_for_llm = "Tool returned no result." ,
334335 result_type = "failure" ,
335336 error = "tool returned no result" ,
336337 tool_telemetry = {},
337338 )
338-
339+ else :
340+ tool_result = result # type: ignore[assignment]
339341
340342 await self .rpc .tools .handle_pending_tool_call (
341343 SessionToolsHandlePendingToolCallParams (
342344 request_id = request_id ,
343345 result = ResultResult (
344- text_result_for_llm = result .text_result_for_llm ,
345- error = result .error ,
346- result_type = result .result_type ,
347- tool_telemetry = result .tool_telemetry ,
346+ text_result_for_llm = tool_result .text_result_for_llm ,
347+ error = tool_result .error ,
348+ result_type = tool_result .result_type ,
349+ tool_telemetry = tool_result .tool_telemetry ,
348350 ),
349351 )
350352 )
You can’t perform that action at this time.
0 commit comments