diff --git a/examples/hosted_mcp/approvals.py b/examples/hosted_mcp/approvals.py index 2cabb3ee2..3080a1d63 100644 --- a/examples/hosted_mcp/approvals.py +++ b/examples/hosted_mcp/approvals.py @@ -48,7 +48,7 @@ async def main(verbose: bool, stream: bool): print(res.final_output) if verbose: - for item in result.new_items: + for item in res.new_items: print(item) diff --git a/examples/hosted_mcp/simple.py b/examples/hosted_mcp/simple.py index 508c3a7ae..895fdfbe0 100644 --- a/examples/hosted_mcp/simple.py +++ b/examples/hosted_mcp/simple.py @@ -34,7 +34,7 @@ async def main(verbose: bool, stream: bool): # The repository is primarily written in multiple languages, including Rust and TypeScript... if verbose: - for item in result.new_items: + for item in res.new_items: print(item) diff --git a/src/agents/_run_impl.py b/src/agents/_run_impl.py index 2cfa270e0..e98010555 100644 --- a/src/agents/_run_impl.py +++ b/src/agents/_run_impl.py @@ -33,6 +33,7 @@ ImageGenerationCall, LocalShellCall, McpApprovalRequest, + McpCall, McpListTools, ) from openai.types.responses.response_reasoning_item import ResponseReasoningItem @@ -456,6 +457,9 @@ def process_model_response( ) elif isinstance(output, McpListTools): items.append(MCPListToolsItem(raw_item=output, agent=agent)) + elif isinstance(output, McpCall): + items.append(ToolCallItem(raw_item=output, agent=agent)) + tools_used.append("mcp") elif isinstance(output, ImageGenerationCall): items.append(ToolCallItem(raw_item=output, agent=agent)) tools_used.append("image_generation")