Add MCP builder support for output/error and caller-supplied item IDs#46985
Add MCP builder support for output/error and caller-supplied item IDs#46985Hameedkunkanoor wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds missing typed MCP streaming capabilities so hosted MCP relay flows can persist canonical completed mcp_call output items with stable IDs and final output/error payloads.
Changes:
- Added optional caller-supplied
item_idtoResponseEventStream.add_output_item_mcp_call(...). - Extended
OutputItemMcpCallBuilder.emit_done(...)to accept optionaloutputanderrorfields. - Added/updated unit tests to cover caller-provided IDs,
emit_done(output=..., error=...), and return-type behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_event_stream.py | Adds optional item_id support for MCP call item creation with basic validation. |
| sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_builders/_tools.py | Adds output/error support to mcp_call done emission. |
| sdk/agentserver/azure-ai-agentserver-responses/tests/unit/test_builders.py | Adds tests for caller-supplied MCP IDs and includes output/error in done events. |
| sdk/agentserver/azure-ai-agentserver-responses/tests/unit/test_emit_return_types.py | Verifies return type remains ResponseOutputItemDoneEvent when passing output/error. |
|
@Hameedkunkanoor please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This PR adds missing typed MCP streaming surface in
azure-ai-agentserver-responsesso hosted MCP relay flows can persist canonical completedmcp_callitems.Changes made
item_idtoadd_output_item_mcp_call(...)so callers can preserve original MCP ids.outputanderrortoOutputItemMcpCallBuilder.emit_done(...)so completed MCP items can carry final tool output/error.emit_done(output=..., error=...)Why this change
mcp_callitem containing call id, call arguments, and final output/error.Breaking change assessment
Testing
Files changed
sdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_builders/_tools.pysdk/agentserver/azure-ai-agentserver-responses/azure/ai/agentserver/responses/streaming/_event_stream.pysdk/agentserver/azure-ai-agentserver-responses/tests/unit/test_builders.pysdk/agentserver/azure-ai-agentserver-responses/tests/unit/test_emit_return_types.pyAll SDK Contribution checklist
General Guidelines and Best Practices
Testing Guidelines