mcp icon indicating copy to clipboard operation
mcp copied to clipboard

Fix foundry agents connect serialization bug

Open JasonYeMSFT opened this issue 1 month ago • 1 comments

What does this PR do?

When the agent run steps include file search tool call result, Azure MCP creates an annonymous object that is not serializable and cause the failure. The fix is to create staticly typed objects instead and register this static type in the Json serialization context. I replaced the function that accepts aribtrary object argument with a few overloads that accept known serializable types to prevent us from passing non-serialzable objects to it.

GitHub issue number?

#1170

Pre-merge Checklist

  • [x] Required for All PRs
    • [x] Read contribution guidelines
    • [x] PR title clearly describes the change
    • [x] Commit history is clean with descriptive messages (cleanup guide)
    • [x] Added comprehensive tests for new/modified functionality
    • [x] Updated servers/Azure.Mcp.Server/CHANGELOG.md and/or servers/Fabric.Mcp.Server/CHANGELOG.md for product changes (features, bug fixes, UI/UX, updated dependencies)
  • [ ] For MCP tool changes:
    • [ ] One tool per PR: This PR adds or modifies only one MCP tool for faster review cycles
    • [ ] Updated servers/Azure.Mcp.Server/README.md and/or servers/Fabric.Mcp.Server/README.md documentation
    • [ ] Validate README.md changes using script at eng/scripts/Process-PackageReadMe.ps1. See Package README
    • [ ] Updated command list in /servers/Azure.Mcp.Server/docs/azmcp-commands.md and/or /docs/fabric-commands.md
    • [ ] Run .\eng\scripts\Update-AzCommandsMetadata.ps1 to update tool metadata in azmcp-commands.md (required for CI)
    • [ ] For new or modified tool descriptions, ran ToolDescriptionEvaluator and obtained a score of 0.4 or more and a top 3 ranking for all related test prompts
    • [ ] For tools with new names, including new tools or renamed tools, update consolidated-tools.json
    • [ ] For new tools associated with Azure services or publicly available tools/APIs/products, add URL to documentation in the PR description
  • [ ] Extra steps for Azure MCP Server tool changes:
    • [ ] Updated test prompts in /servers/Azure.Mcp.Server/docs/e2eTestPrompts.md
    • [ ] 👉 For Community (non-Microsoft team member) PRs:
      • [ ] Security review: Reviewed code for security vulnerabilities, malicious code, or suspicious activities before running tests (crypto mining, spam, data exfiltration, etc.)
      • [ ] Manual tests run: added comment /azp run mcp - pullrequest - live to run Live Test Pipeline

JasonYeMSFT avatar Nov 17 '25 22:11 JasonYeMSFT

@alzimmermsft Can I have one more review on this PR?

JasonYeMSFT avatar Dec 01 '25 18:12 JasonYeMSFT

Rebased to main and updated the position of the change log entry.

JasonYeMSFT avatar Dec 03 '25 18:12 JasonYeMSFT