diff --git a/libraries/microsoft-agents-a365-tooling-extensions-agentframework/README.md b/libraries/microsoft-agents-a365-tooling-extensions-agentframework/README.md index 3c8bc545..ed115007 100644 --- a/libraries/microsoft-agents-a365-tooling-extensions-agentframework/README.md +++ b/libraries/microsoft-agents-a365-tooling-extensions-agentframework/README.md @@ -83,7 +83,6 @@ async def main(): agent_instructions="You are a helpful assistant that can provide weather and restaurant information.", initial_tools=[], # Your existing tools agentic_app_id="user-123", - environment_id="prod", auth_token="your-auth-token" ) @@ -140,7 +139,6 @@ async def main(): """, initial_tools=existing_tools, agentic_app_id="user-123", - environment_id="production", auth_token="your-auth-token" ) @@ -191,7 +189,6 @@ agent = await service.add_tool_servers_to_agent( agent_instructions="You are a helpful assistant with access to various tools.", initial_tools=[], # Your existing tools agentic_app_id="user-123", - environment_id="prod", auth_token="your-token" ) ``` diff --git a/libraries/microsoft-agents-a365-tooling-extensions-agentframework/microsoft_agents_a365/tooling/extensions/agentframework/services/mcp_tool_registration_service.py b/libraries/microsoft-agents-a365-tooling-extensions-agentframework/microsoft_agents_a365/tooling/extensions/agentframework/services/mcp_tool_registration_service.py index a7b366bd..4e0727f0 100644 --- a/libraries/microsoft-agents-a365-tooling-extensions-agentframework/microsoft_agents_a365/tooling/extensions/agentframework/services/mcp_tool_registration_service.py +++ b/libraries/microsoft-agents-a365-tooling-extensions-agentframework/microsoft_agents_a365/tooling/extensions/agentframework/services/mcp_tool_registration_service.py @@ -16,7 +16,6 @@ from microsoft_agents_a365.tooling.utils.utility import ( get_mcp_platform_authentication_scope, - get_use_environment_id, ) @@ -47,7 +46,6 @@ async def add_tool_servers_to_agent( agent_instructions: str, initial_tools: List[Any], agentic_app_id: str, - environment_id: str, auth: Authorization, turn_context: TurnContext, auth_token: Optional[str] = None, @@ -60,7 +58,6 @@ async def add_tool_servers_to_agent( agent_instructions: Instructions for the agent behavior initial_tools: List of initial tools to add to the agent agentic_app_id: Agentic app identifier for the agent - environment_id: Environment identifier for MCP server discovery auth: Authorization context for token exchange turn_context: Turn context for the operation auth_token: Optional bearer token for authentication @@ -75,17 +72,11 @@ async def add_tool_servers_to_agent( authToken = await auth.exchange_token(turn_context, scopes, "AGENTIC") auth_token = authToken.token - if get_use_environment_id(): - self._logger.info( - f"Listing MCP tool servers for agent {agentic_app_id} in environment {environment_id}" - ) - else: - self._logger.info(f"Listing MCP tool servers for agent {agentic_app_id}") + self._logger.info(f"Listing MCP tool servers for agent {agentic_app_id}") # Get MCP server configurations server_configs = await self._mcp_server_configuration_service.list_tool_servers( agentic_app_id=agentic_app_id, - environment_id=environment_id, auth_token=auth_token, ) @@ -110,8 +101,6 @@ async def add_tool_servers_to_agent( headers[Constants.Headers.AUTHORIZATION] = ( f"{Constants.Headers.BEARER_PREFIX} {auth_token}" ) - if get_use_environment_id() and environment_id: - headers[Constants.Headers.ENVIRONMENT_ID] = environment_id server_name = getattr(config, "mcp_server_name", "Unknown") diff --git a/libraries/microsoft-agents-a365-tooling-extensions-azureaifoundry/README.md b/libraries/microsoft-agents-a365-tooling-extensions-azureaifoundry/README.md index 382ec1cc..53016086 100644 --- a/libraries/microsoft-agents-a365-tooling-extensions-azureaifoundry/README.md +++ b/libraries/microsoft-agents-a365-tooling-extensions-azureaifoundry/README.md @@ -64,7 +64,6 @@ registration_service = McpToolRegistrationService() await registration_service.add_tool_servers_to_agent( project_client=project_client, agent_id="your-agent-id", - environment_id="prod", auth_token="your-auth-token" ) ``` diff --git a/libraries/microsoft-agents-a365-tooling-extensions-azureaifoundry/microsoft_agents_a365/tooling/extensions/azureaifoundry/services/mcp_tool_registration_service.py b/libraries/microsoft-agents-a365-tooling-extensions-azureaifoundry/microsoft_agents_a365/tooling/extensions/azureaifoundry/services/mcp_tool_registration_service.py index 7edc67f9..225443ea 100644 --- a/libraries/microsoft-agents-a365-tooling-extensions-azureaifoundry/microsoft_agents_a365/tooling/extensions/azureaifoundry/services/mcp_tool_registration_service.py +++ b/libraries/microsoft-agents-a365-tooling-extensions-azureaifoundry/microsoft_agents_a365/tooling/extensions/azureaifoundry/services/mcp_tool_registration_service.py @@ -18,7 +18,7 @@ from azure.ai.agents.models import McpTool, ToolResources from microsoft_agents.hosting.core import Authorization, TurnContext -from ...common.utils.utility import get_mcp_platform_authentication_scope, get_use_environment_id +from ...common.utils.utility import get_mcp_platform_authentication_scope # Local imports from microsoft_kairo.tooling.common.services.mcp_tool_server_configuration_service import ( @@ -44,7 +44,7 @@ class McpToolRegistrationService: Example: >>> service = McpToolRegistrationService() - >>> service.add_tool_servers_to_agent(project_client, agent_id, env_id, token) + >>> service.add_tool_servers_to_agent(project_client, agent_id, token) """ def __init__( @@ -73,7 +73,6 @@ async def add_tool_servers_to_agent( self, project_client: "AIProjectClient", agentic_app_id: str, - environment_id: str, auth: Authorization, context: TurnContext, auth_token: Optional[str] = None, @@ -84,7 +83,6 @@ async def add_tool_servers_to_agent( Args: project_client: The Azure Foundry AIProjectClient instance. agentic_app_id: Agentic App ID for the agent. - environment_id: Environment ID for the environment. auth_token: Authentication token to access the MCP servers. Raises: @@ -102,7 +100,7 @@ async def add_tool_servers_to_agent( try: # Get the tool definitions and resources using the async implementation tool_definitions, tool_resources = await self._get_mcp_tool_definitions_and_resources( - agentic_app_id, environment_id, auth_token or "" + agentic_app_id, auth_token or "" ) # Update the agent with the tools @@ -121,7 +119,7 @@ async def add_tool_servers_to_agent( raise async def _get_mcp_tool_definitions_and_resources( - self, agentic_app_id: str, environment_id: str, auth_token: str + self, agentic_app_id: str, auth_token: str ) -> Tuple[List[McpTool], Optional[ToolResources]]: """ Internal method to get MCP tool definitions and resources. @@ -130,7 +128,6 @@ async def _get_mcp_tool_definitions_and_resources( Args: agentic_app_id: Agentic App ID for the agent. - environment_id: Environment ID for the environment. auth_token: Authentication token to access the MCP servers. Returns: @@ -143,7 +140,7 @@ async def _get_mcp_tool_definitions_and_resources( # Get MCP server configurations try: servers = await self._mcp_server_configuration_service.list_tool_servers( - agentic_app_id, environment_id, auth_token + agentic_app_id, auth_token ) except Exception as ex: self._logger.error( @@ -152,12 +149,7 @@ async def _get_mcp_tool_definitions_and_resources( return ([], None) if len(servers) == 0: - if get_use_environment_id(): - self._logger.info( - f"No MCP servers configured for AgenticAppId={agentic_app_id}, EnvironmentId={environment_id}" - ) - else: - self._logger.info(f"No MCP servers configured for AgenticAppId={agentic_app_id}") + self._logger.info(f"No MCP servers configured for AgenticAppId={agentic_app_id}") return ([], None) # Collections to build for the return value @@ -196,10 +188,6 @@ async def _get_mcp_tool_definitions_and_resources( ) mcp_tool.update_headers(Constants.Headers.AUTHORIZATION, header_value) - # Set environment ID header - if get_use_environment_id() and environment_id: - mcp_tool.update_headers(Constants.Headers.ENVIRONMENT_ID, environment_id) - # Add to collections tool_definitions.extend(mcp_tool.definitions) if mcp_tool.resources and mcp_tool.resources.mcp: diff --git a/libraries/microsoft-agents-a365-tooling-extensions-openai/README.md b/libraries/microsoft-agents-a365-tooling-extensions-openai/README.md index 6206c0fa..768de3f0 100644 --- a/libraries/microsoft-agents-a365-tooling-extensions-openai/README.md +++ b/libraries/microsoft-agents-a365-tooling-extensions-openai/README.md @@ -54,7 +54,6 @@ registration_service = McpToolRegistrationService() await registration_service.add_tool_servers_to_agent( agent=your_openai_agent, agentic_app_id="user-123", - environment_id="prod", auth=authorization_context, context=turn_context, auth_token="your-auth-token" diff --git a/libraries/microsoft-agents-a365-tooling-extensions-openai/microsoft_agents_a365/tooling/extensions/openai/mcp_tool_registration_service.py b/libraries/microsoft-agents-a365-tooling-extensions-openai/microsoft_agents_a365/tooling/extensions/openai/mcp_tool_registration_service.py index 0c504451..4d8c6866 100644 --- a/libraries/microsoft-agents-a365-tooling-extensions-openai/microsoft_agents_a365/tooling/extensions/openai/mcp_tool_registration_service.py +++ b/libraries/microsoft-agents-a365-tooling-extensions-openai/microsoft_agents_a365/tooling/extensions/openai/mcp_tool_registration_service.py @@ -18,7 +18,6 @@ from microsoft_agents_a365.tooling.utils.utility import ( get_mcp_platform_authentication_scope, - get_use_environment_id, ) @@ -52,7 +51,6 @@ async def add_tool_servers_to_agent( self, agent: Agent, agentic_app_id: str, - environment_id: str, auth: Authorization, context: TurnContext, auth_token: Optional[str] = None, @@ -67,7 +65,6 @@ async def add_tool_servers_to_agent( Args: agent: The existing agent to add servers to agentic_app_id: Agentic App ID for the agent - environment_id: Environment ID for the environment auth_token: Authentication token to access the MCP servers Returns: @@ -83,15 +80,9 @@ async def add_tool_servers_to_agent( # mcp_server_configs = [] # TODO: radevika: Update once the common project is merged. - if get_use_environment_id(): - self._logger.info( - f"Listing MCP tool servers for agent {agentic_app_id} in environment {environment_id}" - ) - else: - self._logger.info(f"Listing MCP tool servers for agent {agentic_app_id}") + self._logger.info(f"Listing MCP tool servers for agent {agentic_app_id}") mcp_server_configs = await self.config_service.list_tool_servers( agentic_app_id=agentic_app_id, - environment_id=environment_id, auth_token=auth_token, ) @@ -138,8 +129,6 @@ async def add_tool_servers_to_agent( headers = si.headers or {} if auth_token: headers["Authorization"] = f"Bearer {auth_token}" - if get_use_environment_id() and environment_id: - headers["x-ms-environment-id"] = environment_id # Create MCPServerStreamableHttpParams with proper configuration params = MCPServerStreamableHttpParams(url=si.url, headers=headers) diff --git a/libraries/microsoft-agents-a365-tooling-extensions-semantickernel/README.md b/libraries/microsoft-agents-a365-tooling-extensions-semantickernel/README.md index 5a53a26c..fb7f680b 100644 --- a/libraries/microsoft-agents-a365-tooling-extensions-semantickernel/README.md +++ b/libraries/microsoft-agents-a365-tooling-extensions-semantickernel/README.md @@ -56,7 +56,6 @@ registration_service = McpToolRegistrationService() await registration_service.add_tool_servers_to_kernel( kernel=kernel, agentic_app_id="user-123", - environment_id="prod", auth_token="your-auth-token" ) ``` diff --git a/libraries/microsoft-agents-a365-tooling-extensions-semantickernel/microsoft_agents_a365/tooling/extensions/semantickernel/services/mcp_tool_registration_service.py b/libraries/microsoft-agents-a365-tooling-extensions-semantickernel/microsoft_agents_a365/tooling/extensions/semantickernel/services/mcp_tool_registration_service.py index e5767b72..06224fd4 100644 --- a/libraries/microsoft-agents-a365-tooling-extensions-semantickernel/microsoft_agents_a365/tooling/extensions/semantickernel/services/mcp_tool_registration_service.py +++ b/libraries/microsoft-agents-a365-tooling-extensions-semantickernel/microsoft_agents_a365/tooling/extensions/semantickernel/services/mcp_tool_registration_service.py @@ -27,7 +27,6 @@ from ...common.utils.utility import ( get_tools_mode, get_mcp_platform_authentication_scope, - get_use_environment_id, ) @@ -85,7 +84,6 @@ async def add_tool_servers_to_agent( self, kernel: sk.Kernel, agentic_app_id: str, - environment_id: str, auth: Authorization, context: TurnContext, auth_token: Optional[str] = None, @@ -96,7 +94,6 @@ async def add_tool_servers_to_agent( Args: kernel: The Semantic Kernel instance to which the tools will be added. agentic_app_id: Agentic App ID for the agent. - environment_id: Environment ID for the environment. auth_token: Authentication token to access the MCP servers. Raises: @@ -109,11 +106,11 @@ async def add_tool_servers_to_agent( authToken = await auth.exchange_token(context, scopes, "AGENTIC") auth_token = authToken.token - self._validate_inputs(kernel, agentic_app_id, environment_id, auth_token) + self._validate_inputs(kernel, agentic_app_id, auth_token) # Get and process servers servers = await self._mcp_server_configuration_service.list_tool_servers( - agentic_app_id, environment_id, auth_token + agentic_app_id, auth_token ) self._logger.info(f"🔧 Adding MCP tools from {len(servers)} servers") @@ -130,17 +127,8 @@ async def add_tool_servers_to_agent( headers = {} if tools_mode == "MockMCPServer": - # Mock server does not require bearer auth, but still forward environment id if available. - if get_use_environment_id() and environment_id: - headers[Constants.Headers.ENVIRONMENT_ID] = environment_id - if mock_auth_header := os.getenv("MOCK_MCP_AUTHORIZATION"): headers[Constants.Headers.AUTHORIZATION] = mock_auth_header - elif get_use_environment_id(): - headers = { - Constants.Headers.AUTHORIZATION: f"{Constants.Headers.BEARER_PREFIX} {auth_token}", - Constants.Headers.ENVIRONMENT_ID: environment_id, - } else: headers = { Constants.Headers.AUTHORIZATION: f"{Constants.Headers.BEARER_PREFIX} {auth_token}", @@ -177,16 +165,12 @@ async def add_tool_servers_to_agent( # Private Methods - Input Validation & Processing # ============================================================================ - def _validate_inputs( - self, kernel: Any, agentic_app_id: str, environment_id: str, auth_token: str - ) -> None: + def _validate_inputs(self, kernel: Any, agentic_app_id: str, auth_token: str) -> None: """Validate all required inputs.""" if kernel is None: raise ValueError("kernel cannot be None") if not agentic_app_id or not agentic_app_id.strip(): raise ValueError("agentic_app_id cannot be null or empty") - if get_use_environment_id() and (not environment_id or not environment_id.strip()): - raise ValueError("environment_id cannot be null or empty") if not auth_token or not auth_token.strip(): raise ValueError("auth_token cannot be null or empty") diff --git a/libraries/microsoft-agents-a365-tooling/README.md b/libraries/microsoft-agents-a365-tooling/README.md index 60e20c44..8fa32db2 100644 --- a/libraries/microsoft-agents-a365-tooling/README.md +++ b/libraries/microsoft-agents-a365-tooling/README.md @@ -59,7 +59,6 @@ mcp_config = MCPServerConfig( config_service = McpToolServerConfigurationService() mcp_servers = await config_service.list_tool_servers( agentic_app_id="agent-123", - environment_id="prod", auth_token="your-auth-token" ) ``` diff --git a/libraries/microsoft-agents-a365-tooling/microsoft_agents_a365/tooling/services/mcp_tool_server_configuration_service.py b/libraries/microsoft-agents-a365-tooling/microsoft_agents_a365/tooling/services/mcp_tool_server_configuration_service.py index 5720d984..625dee28 100644 --- a/libraries/microsoft-agents-a365-tooling/microsoft_agents_a365/tooling/services/mcp_tool_server_configuration_service.py +++ b/libraries/microsoft-agents-a365-tooling/microsoft_agents_a365/tooling/services/mcp_tool_server_configuration_service.py @@ -30,11 +30,7 @@ # Local imports from ..models import MCPServerConfig from ..utils import Constants -from ..utils.utility import ( - get_tooling_gateway_for_digital_worker, - build_mcp_server_url, - get_use_environment_id, -) +from ..utils.utility import get_tooling_gateway_for_digital_worker, build_mcp_server_url # ============================================================================== @@ -70,14 +66,13 @@ def __init__(self, logger: Optional[logging.Logger] = None): # -------------------------------------------------------------------------- async def list_tool_servers( - self, agentic_app_id: str, environment_id: str, auth_token: str + self, agentic_app_id: str, auth_token: str ) -> List[MCPServerConfig]: """ Gets the list of MCP Servers that are configured for the agent. Args: agentic_app_id: Agentic App ID for the agent. - environment_id: Environment ID for the environment. auth_token: Authentication token to access the MCP servers. Returns: @@ -88,20 +83,15 @@ async def list_tool_servers( Exception: If there's an error communicating with the tooling gateway. """ # Validate input parameters - self._validate_input_parameters(agentic_app_id, environment_id, auth_token) + self._validate_input_parameters(agentic_app_id, auth_token) - if get_use_environment_id(): - self._logger.info( - f"Listing MCP tool servers for agent {agentic_app_id} in environment {environment_id}" - ) - else: - self._logger.info(f"Listing MCP tool servers for agent {agentic_app_id}") + self._logger.info(f"Listing MCP tool servers for agent {agentic_app_id}") # Determine configuration source based on environment if self._is_development_scenario(): - return self._load_servers_from_manifest(environment_id) + return self._load_servers_from_manifest() else: - return await self._load_servers_from_gateway(agentic_app_id, environment_id, auth_token) + return await self._load_servers_from_gateway(agentic_app_id, auth_token) # -------------------------------------------------------------------------- # ENVIRONMENT DETECTION @@ -124,7 +114,7 @@ def _is_development_scenario(self) -> bool: # DEVELOPMENT: MANIFEST-BASED CONFIGURATION # -------------------------------------------------------------------------- - def _load_servers_from_manifest(self, environment_id: str) -> List[MCPServerConfig]: + def _load_servers_from_manifest(self) -> List[MCPServerConfig]: """ Reads MCP server configurations from ToolingManifest.json in the application's content root. @@ -144,9 +134,6 @@ def _load_servers_from_manifest(self, environment_id: str) -> List[MCPServerConf ] } - Args: - environment_id: Environment ID to construct full URLs. - Returns: List[MCPServerConfig]: List of MCP server configurations from manifest. @@ -160,7 +147,7 @@ def _load_servers_from_manifest(self, environment_id: str) -> List[MCPServerConf if manifest_path and manifest_path.exists(): self._logger.info(f"Loading MCP servers from: {manifest_path}") - mcp_servers = self._parse_manifest_file(manifest_path, environment_id) + mcp_servers = self._parse_manifest_file(manifest_path) else: self._log_manifest_search_failure() @@ -225,15 +212,12 @@ def _get_manifest_search_locations(self) -> List[Path]: return search_locations - def _parse_manifest_file( - self, manifest_path: Path, environment_id: str - ) -> List[MCPServerConfig]: + def _parse_manifest_file(self, manifest_path: Path) -> List[MCPServerConfig]: """ Parses the manifest file and extracts MCP server configurations. Args: manifest_path: Path to the manifest file. - environment_id: Environment ID for URL construction. Returns: List of parsed MCP server configurations. @@ -255,9 +239,7 @@ def _parse_manifest_file( print(f"📊 Processing {len(mcp_servers_data)} server entries") for server_element in mcp_servers_data: print(f"🔧 Processing server element: {server_element}") - server_config = self._parse_manifest_server_config( - server_element, environment_id - ) + server_config = self._parse_manifest_server_config(server_element) if server_config is not None: print( f"✅ Created server config: {server_config.mcp_server_name} -> {server_config.mcp_server_unique_name}" @@ -293,14 +275,13 @@ def _log_manifest_search_failure(self) -> None: # -------------------------------------------------------------------------- async def _load_servers_from_gateway( - self, agentic_app_id: str, environment_id: str, auth_token: str + self, agentic_app_id: str, auth_token: str ) -> List[MCPServerConfig]: """ Reads MCP server configurations from tooling gateway endpoint for production scenario. Args: agentic_app_id: Agentic App ID for the agent. - environment_id: Environment ID for the environment. auth_token: Authentication token to access the tooling gateway. Returns: @@ -313,7 +294,7 @@ async def _load_servers_from_gateway( try: config_endpoint = get_tooling_gateway_for_digital_worker(agentic_app_id) - headers = self._prepare_gateway_headers(auth_token, environment_id) + headers = self._prepare_gateway_headers(auth_token) self._logger.info(f"Calling tooling gateway endpoint: {config_endpoint}") @@ -342,22 +323,16 @@ async def _load_servers_from_gateway( return mcp_servers - def _prepare_gateway_headers(self, auth_token: str, environment_id: str) -> Dict[str, str]: + def _prepare_gateway_headers(self, auth_token: str) -> Dict[str, str]: """ Prepares headers for tooling gateway requests. Args: auth_token: Authentication token. - environment_id: Environment ID. Returns: Dictionary of HTTP headers. """ - if get_use_environment_id(): - return { - "Authorization": f"{Constants.Headers.BEARER_PREFIX} {auth_token}", - Constants.Headers.ENVIRONMENT_ID: environment_id, - } return { "Authorization": f"{Constants.Headers.BEARER_PREFIX} {auth_token}", } @@ -392,14 +367,13 @@ async def _parse_gateway_response( # -------------------------------------------------------------------------- def _parse_manifest_server_config( - self, server_element: Dict[str, Any], environment_id: str + self, server_element: Dict[str, Any] ) -> Optional[MCPServerConfig]: """ Parses a server configuration from manifest data, constructing full URL. Args: server_element: Dictionary containing server configuration from manifest. - environment_id: Environment ID to construct full URL. Returns: MCPServerConfig object or None if parsing fails. @@ -412,7 +386,7 @@ def _parse_manifest_server_config( return None # Construct full URL using environment utilities - full_url = build_mcp_server_url(environment_id, server_name) + full_url = build_mcp_server_url(server_name) return MCPServerConfig(mcp_server_name=name, mcp_server_unique_name=full_url) @@ -447,15 +421,12 @@ def _parse_gateway_server_config( # VALIDATION AND UTILITY HELPERS # -------------------------------------------------------------------------- - def _validate_input_parameters( - self, agentic_app_id: str, environment_id: str, auth_token: str - ) -> None: + def _validate_input_parameters(self, agentic_app_id: str, auth_token: str) -> None: """ Validates input parameters for the main API method. Args: agentic_app_id: Agentic App ID to validate. - environment_id: Environment ID to validate. auth_token: Authentication token to validate. Raises: @@ -463,8 +434,6 @@ def _validate_input_parameters( """ if not agentic_app_id: raise ValueError("agentic_app_id cannot be empty or None") - if get_use_environment_id() and not environment_id: - raise ValueError("environment_id cannot be empty or None") if not auth_token: raise ValueError("auth_token cannot be empty or None") diff --git a/libraries/microsoft-agents-a365-tooling/microsoft_agents_a365/tooling/utils/constants.py b/libraries/microsoft-agents-a365-tooling/microsoft_agents_a365/tooling/utils/constants.py index 02e02b2d..eabb0f2d 100644 --- a/libraries/microsoft-agents-a365-tooling/microsoft_agents_a365/tooling/utils/constants.py +++ b/libraries/microsoft-agents-a365-tooling/microsoft_agents_a365/tooling/utils/constants.py @@ -12,7 +12,7 @@ class Constants: class Headers: """ - Provides constant header values used for authentication and environment identification. + Provides constant header values used for authentication. """ #: The header name used for HTTP authorization tokens. @@ -20,6 +20,3 @@ class Headers: #: The prefix used for Bearer authentication tokens in HTTP headers. BEARER_PREFIX = "Bearer" - - #: The header name used to specify the environment identifier in HTTP requests. - ENVIRONMENT_ID = "x-ms-environment-id" diff --git a/libraries/microsoft-agents-a365-tooling/microsoft_agents_a365/tooling/utils/utility.py b/libraries/microsoft-agents-a365-tooling/microsoft_agents_a365/tooling/utils/utility.py index 7b5e0e74..5191bfcf 100644 --- a/libraries/microsoft-agents-a365-tooling/microsoft_agents_a365/tooling/utils/utility.py +++ b/libraries/microsoft-agents-a365-tooling/microsoft_agents_a365/tooling/utils/utility.py @@ -50,32 +50,22 @@ def get_mcp_base_url() -> str: if tools_mode == ToolsMode.MOCK_MCP_SERVER: return os.getenv("MOCK_MCP_SERVER_URL", "http://localhost:5309/mcp-mock/agents/servers") - if not get_use_environment_id(): - return f"{_get_mcp_platform_base_url()}/agents/servers" + return f"{_get_mcp_platform_base_url()}/agents/servers" - return f"{_get_mcp_platform_base_url()}/mcp/environments" - -def build_mcp_server_url(environment_id: str, server_name: str) -> str: +def build_mcp_server_url(server_name: str) -> str: """ - Constructs the full MCP server URL using the base URL, environment ID, and server name. + Constructs the full MCP server URL using the base URL and server name. Args: - environment_id: The environment ID. server_name: The MCP server name. Returns: str: The full MCP server URL. """ base_url = get_mcp_base_url() - environment = _get_current_environment().lower() - if not get_use_environment_id() or ( - environment == "development" and base_url.endswith("servers") - ): - return f"{base_url}/{server_name}" - else: - return f"{base_url}/{environment_id}/servers/{server_name}" + return f"{base_url}/{server_name}" def _get_current_environment() -> str: @@ -101,17 +91,6 @@ def _get_mcp_platform_base_url() -> str: return MCP_PLATFORM_PROD_BASE_URL -def get_use_environment_id() -> bool: - """ - Determines whether to use environment ID in MCP server URL construction. - - Returns: - bool: True if environment ID should be used, False otherwise. - """ - use_environment = os.getenv("USE_ENVIRONMENT_ID", "true").lower() - return use_environment == "true" - - def get_tools_mode() -> ToolsMode: """ Gets the tools mode for the application.