@@ -303,24 +303,20 @@ async def wrapped(
303303 _name_owned_by_real_tool_v2 (server , name ) is False
304304 ):
305305 virtual_content = [
306- mcp_types .TextContent (type = "text" , text = get_more_tools_result_text ())
306+ mcp_types .TextContent (type = "text" , text = text )
307+ for text in lifecycle .virtual_result_texts (get_more_tools_result_text ())
307308 ]
308- if prompt_back := lifecycle .prompt_back_text ():
309- virtual_content .append (
310- mcp_types .TextContent (type = "text" , text = prompt_back )
311- )
312309 await lifecycle .record_missing_capability (conversation_id_delivered = True )
313310 return mcp_types .CallToolResult (content = virtual_content )
314311
315312 if lifecycle .is_feedback and (
316313 _name_owned_by_real_tool_v2 (server , name ) is False
317314 ):
318315 reply = await lifecycle .record_feedback (conversation_id_delivered = True )
319- virtual_content = [mcp_types .TextContent (type = "text" , text = reply )]
320- if prompt_back := lifecycle .prompt_back_text ():
321- virtual_content .append (
322- mcp_types .TextContent (type = "text" , text = prompt_back )
323- )
316+ virtual_content = [
317+ mcp_types .TextContent (type = "text" , text = text )
318+ for text in lifecycle .virtual_result_texts (reply )
319+ ]
324320 return mcp_types .CallToolResult (content = virtual_content )
325321
326322 # v2 validates against the function signature and rejects unexpected
@@ -531,24 +527,20 @@ async def handler(ctx: Any, params: Any) -> Any:
531527 await raw_listing_owns_tool_name (data , name , ctx ) is False
532528 ):
533529 virtual_content = [
534- mcp_types .TextContent (type = "text" , text = get_more_tools_result_text ())
530+ mcp_types .TextContent (type = "text" , text = text )
531+ for text in lifecycle .virtual_result_texts (get_more_tools_result_text ())
535532 ]
536- if prompt_back := lifecycle .prompt_back_text ():
537- virtual_content .append (
538- mcp_types .TextContent (type = "text" , text = prompt_back )
539- )
540533 await lifecycle .record_missing_capability (conversation_id_delivered = True )
541534 return mcp_types .CallToolResult (content = virtual_content )
542535
543536 if lifecycle .is_feedback and (
544537 await raw_listing_owns_tool_name (data , name , ctx ) is False
545538 ):
546539 reply = await lifecycle .record_feedback (conversation_id_delivered = True )
547- virtual_content = [mcp_types .TextContent (type = "text" , text = reply )]
548- if prompt_back := lifecycle .prompt_back_text ():
549- virtual_content .append (
550- mcp_types .TextContent (type = "text" , text = prompt_back )
551- )
540+ virtual_content = [
541+ mcp_types .TextContent (type = "text" , text = text )
542+ for text in lifecycle .virtual_result_texts (reply )
543+ ]
552544 return mcp_types .CallToolResult (content = virtual_content )
553545
554546 # Settle the shared session before the tool body runs, so an in-tool
0 commit comments