Skip to content

Commit e2df634

Browse files
authored
Add use env id check to validation and update logs (#21)
1 parent ba18d9b commit e2df634

File tree

5 files changed

+27
-14
lines changed

5 files changed

+27
-14
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,12 @@ async def add_tool_servers_to_agent(
7575
authToken = await auth.exchange_token(turn_context, scopes, "AGENTIC")
7676
auth_token = authToken.token
7777

78-
self._logger.info(
79-
f"Listing MCP tool servers for agent {agentic_app_id} in environment {environment_id}"
80-
)
78+
if get_use_environment_id():
79+
self._logger.info(
80+
f"Listing MCP tool servers for agent {agentic_app_id} in environment {environment_id}"
81+
)
82+
else:
83+
self._logger.info(f"Listing MCP tool servers for agent {agentic_app_id}")
8184

8285
# Get MCP server configurations
8386
server_configs = await self._mcp_server_configuration_service.list_tool_servers(

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,12 @@ async def _get_mcp_tool_definitions_and_resources(
152152
return ([], None)
153153

154154
if len(servers) == 0:
155-
self._logger.info(
156-
f"No MCP servers configured for AgenticAppId={agentic_app_id}, EnvironmentId={environment_id}"
157-
)
155+
if get_use_environment_id():
156+
self._logger.info(
157+
f"No MCP servers configured for AgenticAppId={agentic_app_id}, EnvironmentId={environment_id}"
158+
)
159+
else:
160+
self._logger.info(f"No MCP servers configured for AgenticAppId={agentic_app_id}")
158161
return ([], None)
159162

160163
# Collections to build for the return value

libraries/microsoft-agents-a365-tooling-extensions-openai/microsoft_agents_a365/tooling/extensions/openai/mcp_tool_registration_service.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,13 @@ async def add_tool_servers_to_agent(
8282
# Get MCP server configurations from the configuration service
8383
# mcp_server_configs = []
8484
# TODO: radevika: Update once the common project is merged.
85-
self._logger.info(
86-
f"Listing MCP tool servers for agent {agentic_app_id} in environment {environment_id}"
87-
)
85+
86+
if get_use_environment_id():
87+
self._logger.info(
88+
f"Listing MCP tool servers for agent {agentic_app_id} in environment {environment_id}"
89+
)
90+
else:
91+
self._logger.info(f"Listing MCP tool servers for agent {agentic_app_id}")
8892
mcp_server_configs = await self.config_service.list_tool_servers(
8993
agentic_app_id=agentic_app_id,
9094
environment_id=environment_id,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def _validate_inputs(
185185
raise ValueError("kernel cannot be None")
186186
if not agentic_app_id or not agentic_app_id.strip():
187187
raise ValueError("agentic_app_id cannot be null or empty")
188-
if not environment_id or not environment_id.strip():
188+
if get_use_environment_id() and (not environment_id or not environment_id.strip()):
189189
raise ValueError("environment_id cannot be null or empty")
190190
if not auth_token or not auth_token.strip():
191191
raise ValueError("auth_token cannot be null or empty")

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,12 @@ async def list_tool_servers(
9090
# Validate input parameters
9191
self._validate_input_parameters(agentic_app_id, environment_id, auth_token)
9292

93-
self._logger.info(
94-
f"Listing MCP tool servers for agent {agentic_app_id} in environment {environment_id}"
95-
)
93+
if get_use_environment_id():
94+
self._logger.info(
95+
f"Listing MCP tool servers for agent {agentic_app_id} in environment {environment_id}"
96+
)
97+
else:
98+
self._logger.info(f"Listing MCP tool servers for agent {agentic_app_id}")
9699

97100
# Determine configuration source based on environment
98101
if self._is_development_scenario():
@@ -460,7 +463,7 @@ def _validate_input_parameters(
460463
"""
461464
if not agentic_app_id:
462465
raise ValueError("agentic_app_id cannot be empty or None")
463-
if not environment_id:
466+
if get_use_environment_id() and not environment_id:
464467
raise ValueError("environment_id cannot be empty or None")
465468
if not auth_token:
466469
raise ValueError("auth_token cannot be empty or None")

0 commit comments

Comments
 (0)