Skip to content

Commit 967d25a

Browse files
Copilotpontemonti
andcommitted
Improve exception handling and clarify test comments
Co-authored-by: pontemonti <7850950+pontemonti@users.noreply.github.com>
1 parent 31f547a commit 967d25a

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

‎libraries/microsoft-agents-a365-tooling-extensions-agentframework/microsoft_agents_a365/tooling/extensions/agentframework/services/mcp_tool_registration_service.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,12 @@ async def add_tool_servers_to_agent(
133133
self._logger.info(f"Added MCP plugin '{server_name}' to agent tools")
134134

135135
except Exception as tool_ex:
136+
try:
137+
server_name = config.mcp_server_name
138+
except AttributeError:
139+
server_name = "Unknown"
136140
self._logger.warning(
137-
f"Failed to create MCP plugin for {config.mcp_server_name}: {tool_ex}"
141+
f"Failed to create MCP plugin for {server_name}: {tool_ex}"
138142
)
139143
continue
140144

‎tests/tooling/test_mcp_server_configuration.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def test_parse_manifest_server_config_without_custom_url(self, mock_build_url, s
123123

124124
assert config is not None
125125
assert config.mcp_server_name == "DefaultServer"
126-
# When no custom URL, the built URL goes into mcp_server_unique_name
126+
# Without a custom URL, build_mcp_server_url constructs the full URL and stores it in mcp_server_unique_name
127127
assert config.mcp_server_unique_name == "https://default.server/agents/servers/test_server"
128128
mock_build_url.assert_called_once_with("test_server")
129129

0 commit comments

Comments
 (0)