Azure / Azure/azure-sdk-for-python
MCP tool completed event was issued twice when a mcp call is done.
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 3.4k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 193
Description
- **Package Name**: azure-ai-agent
- **Package Version**: 1.2.0b3
- **Operating System**: Windows
- **Python Version**: 3.11.9
**Describe the bug**
MCP tool completed event was issued twice when a MCP call is done. Below is the output by the mcp call sample program, https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-agents/samples/agents_streaming/sample_agents_stream_iteration_with_mcp.py.
We can see there are two mcp call step completed events.
RunStepDeltaChunk received. ID: step_Kqeuu8EuBUR8PCgzjDtQrlSU.
RunStepDeltaChunk received. ID: step_Kqeuu8EuBUR8PCgzjDtQrlSU.
ThreadRun status: RunStatus.REQUIRES_ACTION
Approving tool call: {'id': 'call_iPejadoUkwLXf42HhGxNtJBA', 'type': 'mcp', 'arguments': '{"query":"Azure CLI command to list Azure Container Apps"}', 'name': 'microsoft_docs_search', 'server_label': 'msdocs'}
tool_approvals: [{'tool_call_id': 'call_iPejadoUkwLXf42HhGxNtJBA', 'approve': True, 'headers': {}}]
Stream completed.
**RunStep type: RunStepType.TOOL_CALLS, Status: RunStepStatus.COMPLETED
MCP Tool calls:
Tool Call ID: call_iPejadoUkwLXf42HhGxNtJBA
Type: mcp**
ThreadRun status: RunStatus.QUEUED
ThreadRun status: RunStatus.IN_PROGRESS
RunStepDeltaChunk received. ID: step_Kqeuu8EuBUR8PCgzjDtQrlSU.
**RunStep type: RunStepType.TOOL_CALLS, Status: RunStepStatus.COMPLETED
MCP Tool calls:
Tool Call ID: call_iPejadoUkwLXf42HhGxNtJBA
Type: mcp**
**To Reproduce**
Steps to reproduce the behavior:
Use the sample program with a MCP server (https://learn.microsoft.com/api/mcp), https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-agents/samples/agents_streaming/sample_agents_stream_iteration_with_mcp.py
**Expected behavior**
A clear and concise description of what you expected to happen.
MCP call completed step event should be issued only once.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Additional context**
Add any other context about the problem here.
Contributor guide
Assessment
This issue has not been assessed yet.