[ai-agents] Fix MCP tool field mapping - #8038
Conversation
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 MCP YAML-to-API conversion for azd ai agent init so sample-style MCP manifests keep their routing metadata when converted, especially for Foundry-backed connections.
Changes:
- Add
foundryas a recognized connection kind with a typedFoundryConnectionparser shape. - Map top-level MCP
urlto APIServerURLand deriveProjectConnectionIDfrom named MCP connections. - Add regression coverage for sample-style MCP manifests, including fallback from
serverNameto the tool name.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_yaml/yaml.go |
Adds the new MCP/connection fields needed to represent sample-style Foundry manifests. |
cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_yaml/parse.go |
Extends connection parsing to recognize foundry connections. |
cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_yaml/map.go |
Updates MCP tool mapping to preserve server label, server URL, and project connection ID. |
cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_yaml/map_test.go |
Adds a regression test for the new MCP manifest mapping behavior. |
📋 Prioritization NoteThanks for the contribution! The linked issue isn't in the current milestone yet. |
|
@copilot apply changes based on the comments in this thread |
…ack for ServerURL Agent-Logs-Url: https://github.com/Azure/azure-dev/sessions/63d4b8ea-3699-4818-a5f8-58a92efac573 Co-authored-by: glharper <64209257+glharper@users.noreply.github.com>
Done in c1233a7:
|
jongio
left a comment
There was a problem hiding this comment.
Clean, focused fix. The data flow through ExtractToolsDefinitions -> ExtractConnectionDefinition -> convertYamlToolToApiTool is correct, and the precedence (top-level url sets initial value, options["serverUrl"] can override) is the right call.
One inline comment on naming. The bot's Url -> URL point is valid - the rest of the API layer uses ServerURL, BaseURL, etc.
Re-Review — PR #8038 (commit c1233a7)Recommendation: Approve ✅ All substantive feedback from the first review has been addressed. The Url to URL naming fix, serverName precedence test, and FoundryConnection endpoint fallback logic all look correct. Remaining nitpick: Test assertion at ~line 552 should print actual value for consistency. Ship it. 👍 |
jongio
left a comment
There was a problem hiding this comment.
Incremental review of commits since my last look: both findings addressed. Url renamed to URL, and FoundryConnection removed in favor of reusing RemoteConnection (cleaner). The ServerLabel fallback logic moved to runtime enrichment in enrichToolboxFromConnections, which is the right layer for it. No new issues.
|
@copilot resolve the merge conflicts in this pull request |
…s-mcp-tool-fields Co-authored-by: glharper <64209257+glharper@users.noreply.github.com>
Merged |
|
/check-enforcer override |
* Fix MCP tool field mapping * Fix McpTool.Url field naming and add FoundryConnection.Endpoint fallback for ServerURL Agent-Logs-Url: https://github.com/Azure/azure-dev/sessions/63d4b8ea-3699-4818-a5f8-58a92efac573 Co-authored-by: glharper <64209257+glharper@users.noreply.github.com> * Address MCP connection enrichment feedback * remove ConnectionKindFoundry --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: therealjohn <1501196+therealjohn@users.noreply.github.com>
Summary
Fixes #8037
Preserves MCP routing fields when
azd ai agent initand toolbox provisioning process MCP tool manifests. Top-level MCPurlnow maps to the APIserver_url,connection.nameis preserved as the project connection id, and toolbox tools are enriched from the full configured connection set before being sent to the Foundry Toolsets API.Details
kind: foundryMCP connections as the existing remote connection shape instead of introducing a duplicate type.urlduring YAML-to-API conversion.project_connection_idduring YAML-to-API conversion.connectionsandtoolConnectionswhen fillingserver_urlandserver_label.Validation