azure-sdk-for-python icon indicating copy to clipboard operation
azure-sdk-for-python copied to clipboard

MCP tool completed event was issued twice when a mcp call is done.

Open cqzheng opened this issue 1 year ago • 8 comments

  • 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.

cqzheng avatar Aug 29 '25 07:08 cqzheng

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @luigiw @needuv @paulshealy1 @singankit.

github-actions[bot] avatar Aug 29 '25 07:08 github-actions[bot]

looks like the same issue reported in #42700

ITWApple avatar Aug 29 '25 14:08 ITWApple

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @dargilco @glharper @howieleung @jhakulin @nick863 @trangevi.

github-actions[bot] avatar Sep 08 '25 17:09 github-actions[bot]

@cqzheng The bug mentioned above has been fixed, could you recheck this issue and let us know if you're still experiencing this behavior?

glharper avatar Sep 08 '25 21:09 glharper

@glharper Thanks!!! May I ask when I can verify the fix on a new release? I experienced the issue on 1.1.0b3 but didn't see a new release after it.

cqzheng avatar Sep 09 '25 07:09 cqzheng

@cqzheng Current preview version is 1.2.0b3, but I believe this fix is service side, not in the SDK. Even so, best to use the latest.

glharper avatar Sep 09 '25 12:09 glharper

@glharper I tried 1.2.0b3 SDK and still experienced the issue.

cqzheng avatar Sep 10 '25 03:09 cqzheng

@apryiomka FYI

glharper avatar Sep 10 '25 15:09 glharper