Python: Persist hosted MCP call/results as canonical mcp_call output#6070
Open
Hameedkunkanoor wants to merge 8 commits into
Open
Python: Persist hosted MCP call/results as canonical mcp_call output#6070Hameedkunkanoor wants to merge 8 commits into
Hameedkunkanoor wants to merge 8 commits into
Conversation
- Preserve hosted MCP call/result pairs as canonical mcp_call output items - Coalesce MCP call + result in non-streaming conversion path - Keep call-id alignment for MCP tool call tracking and output mapping - Update tests and package metadata
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR updates the Foundry hosting responses adapter to coalesce hosted MCP tool call + tool result into a single mcp_call output item (including output), adds round-trip coverage for the new behavior, and bumps the azure-ai-agentserver-responses dependency to pick up the needed model/events support.
Changes:
- Coalesce hosted MCP
mcp_server_tool_call+mcp_server_tool_resultinto a singlemcp_calloutput item (non-streaming and streaming). - Reconstruct MCP result content when reading
mcp_callitems that includeoutput. - Add tests for persistence, streaming emission, reconstruction, and multi-turn history replay; bump
azure-ai-agentserver-responsestob6.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| python/packages/foundry_hosting/agent_framework_foundry_hosting/_responses.py | Adds hosted-MCP coalescing and output stringification; updates streaming handler and item-to-message reconstruction to carry MCP output. |
| python/packages/foundry_hosting/tests/test_responses.py | Adds regression tests ensuring MCP calls/results persist/stream as a single mcp_call and replay correctly across turns. |
| python/packages/foundry_hosting/pyproject.toml | Bumps azure-ai-agentserver-responses to a newer beta required for MCP output support. |
Contributor
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
moonbox3
approved these changes
May 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
This PR recreates and carries forward the original hosted MCP persistence fix from #5950, adapted on top of current main and finalized with follow-up CI/type-safety hardening.
Fix for #5546.
Problem addressed:
Scenario supported:
Dependency and rollout note:
Description
Overall approach:
Changes made:
Files changed:
Validation
Risk / Impact
Relationship to Prior PR
Contribution Checklist