Skip to content

Commit ccaa294

Browse files
Copilotpontemonti
andcommitted
Use 'url' field consistently in both manifest and gateway responses
Co-authored-by: pontemonti <7850950+pontemonti@users.noreply.github.com>
1 parent 7ce0f25 commit ccaa294

2 files changed

Lines changed: 5 additions & 12 deletions

File tree

libraries/microsoft-agents-a365-tooling/microsoft_agents_a365/tooling/services/mcp_tool_server_configuration_service.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -501,9 +501,7 @@ def _extract_server_url(self, server_element: Dict[str, Any]) -> Optional[str]:
501501
Returns:
502502
Server URL string or None.
503503
"""
504-
# Check for 'mcpServerUrl' (manifest) or 'url' (gateway)
505-
if "mcpServerUrl" in server_element and isinstance(server_element["mcpServerUrl"], str):
506-
return server_element["mcpServerUrl"]
504+
# Check for 'url' field in both manifest and gateway responses
507505
if "url" in server_element and isinstance(server_element["url"], str):
508506
return server_element["url"]
509507
return None

tests/tooling/test_mcp_server_configuration.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,22 +72,17 @@ def mock_manifest_data(self) -> Dict[str, Any]:
7272
{
7373
"mcpServerName": "TestServer2",
7474
"mcpServerUniqueName": "test_server_2",
75-
"mcpServerUrl": "https://custom.server.com/mcp",
75+
"url": "https://custom.server.com/mcp",
7676
},
7777
]
7878
}
7979

8080
def test_extract_server_url_from_manifest(self, service):
8181
"""Test extracting custom URL from manifest element."""
82-
# Test with mcpServerUrl field
83-
element = {"mcpServerUrl": "https://custom.url.com"}
84-
url = service._extract_server_url(element)
85-
assert url == "https://custom.url.com"
86-
8782
# Test with url field
88-
element = {"url": "https://another.url.com"}
83+
element = {"url": "https://custom.url.com"}
8984
url = service._extract_server_url(element)
90-
assert url == "https://another.url.com"
85+
assert url == "https://custom.url.com"
9186

9287
# Test with no URL
9388
element = {}
@@ -99,7 +94,7 @@ def test_parse_manifest_server_config_with_custom_url(self, service):
9994
server_element = {
10095
"mcpServerName": "CustomServer",
10196
"mcpServerUniqueName": "custom_server",
102-
"mcpServerUrl": "https://my.custom.server/mcp",
97+
"url": "https://my.custom.server/mcp",
10398
}
10499

105100
config = service._parse_manifest_server_config(server_element)

0 commit comments

Comments
 (0)