Skip to content

Commit c6473e7

Browse files
committed
Remove environment id usage
1 parent 8826464 commit c6473e7

File tree

10 files changed

+30
-72
lines changed

10 files changed

+30
-72
lines changed

libraries/microsoft-agents-a365-tooling-extensions-azureaifoundry/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ registration_service = McpToolRegistrationService()
6464
await registration_service.add_tool_servers_to_agent(
6565
project_client=project_client,
6666
agent_id="your-agent-id",
67-
environment_id="prod",
6867
auth_token="your-auth-token"
6968
)
7069
```

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

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class McpToolRegistrationService:
4444
4545
Example:
4646
>>> service = McpToolRegistrationService()
47-
>>> service.add_tool_servers_to_agent(project_client, agent_id, env_id, token)
47+
>>> service.add_tool_servers_to_agent(project_client, agent_id, token)
4848
"""
4949

5050
def __init__(
@@ -73,7 +73,6 @@ async def add_tool_servers_to_agent(
7373
self,
7474
project_client: "AIProjectClient",
7575
agent_user_id: str,
76-
environment_id: str,
7776
auth: Authorization,
7877
context: TurnContext,
7978
auth_token: Optional[str] = None,
@@ -84,7 +83,6 @@ async def add_tool_servers_to_agent(
8483
Args:
8584
project_client: The Azure Foundry AIProjectClient instance.
8685
agent_user_id: Agent User ID for the agent.
87-
environment_id: Environment ID for the environment.
8886
auth_token: Authentication token to access the MCP servers.
8987
9088
Raises:
@@ -102,7 +100,7 @@ async def add_tool_servers_to_agent(
102100
try:
103101
# Get the tool definitions and resources using the async implementation
104102
tool_definitions, tool_resources = await self._get_mcp_tool_definitions_and_resources(
105-
agent_user_id, environment_id, auth_token or ""
103+
agent_user_id, auth_token or ""
106104
)
107105

108106
# Update the agent with the tools
@@ -121,7 +119,7 @@ async def add_tool_servers_to_agent(
121119
raise
122120

123121
async def _get_mcp_tool_definitions_and_resources(
124-
self, agent_user_id: str, environment_id: str, auth_token: str
122+
self, agent_user_id: str, auth_token: str
125123
) -> Tuple[List[McpTool], Optional[ToolResources]]:
126124
"""
127125
Internal method to get MCP tool definitions and resources.
@@ -130,7 +128,6 @@ async def _get_mcp_tool_definitions_and_resources(
130128
131129
Args:
132130
agent_user_id: Agent User ID for the agent.
133-
environment_id: Environment ID for the environment.
134131
auth_token: Authentication token to access the MCP servers.
135132
136133
Returns:
@@ -143,7 +140,7 @@ async def _get_mcp_tool_definitions_and_resources(
143140
# Get MCP server configurations
144141
try:
145142
servers = await self._mcp_server_configuration_service.list_tool_servers(
146-
agent_user_id, environment_id, auth_token
143+
agent_user_id, auth_token
147144
)
148145
except Exception as ex:
149146
self._logger.error(
@@ -153,7 +150,7 @@ async def _get_mcp_tool_definitions_and_resources(
153150

154151
if len(servers) == 0:
155152
self._logger.info(
156-
f"No MCP servers configured for AgentUserId={agent_user_id}, EnvironmentId={environment_id}"
153+
f"No MCP servers configured for AgentUserId={agent_user_id}"
157154
)
158155
return ([], None)
159156

@@ -193,9 +190,6 @@ async def _get_mcp_tool_definitions_and_resources(
193190
)
194191
mcp_tool.update_headers(Constants.Headers.AUTHORIZATION, header_value)
195192

196-
# Set environment ID header
197-
mcp_tool.update_headers(Constants.Headers.ENVIRONMENT_ID, environment_id)
198-
199193
# Add to collections
200194
tool_definitions.extend(mcp_tool.definitions)
201195
if mcp_tool.resources and mcp_tool.resources.mcp:

libraries/microsoft-agents-a365-tooling-extensions-openai/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ registration_service = McpToolRegistrationService()
5454
await registration_service.add_tool_servers_to_agent(
5555
agent=your_openai_agent,
5656
agent_user_id="user-123",
57-
environment_id="prod",
5857
auth=authorization_context,
5958
context=turn_context,
6059
auth_token="your-auth-token"

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ async def add_tool_servers_to_agent(
3939
self,
4040
agent: Agent,
4141
agent_user_id: str,
42-
environment_id: str,
4342
auth: Authorization,
4443
context: TurnContext,
4544
auth_token: Optional[str] = None,
@@ -54,7 +53,6 @@ async def add_tool_servers_to_agent(
5453
Args:
5554
agent: The existing agent to add servers to
5655
agent_user_id: Agent User ID for the agent
57-
environment_id: Environment ID for the environment
5856
auth_token: Authentication token to access the MCP servers
5957
6058
Returns:
@@ -70,7 +68,7 @@ async def add_tool_servers_to_agent(
7068
# mcp_server_configs = []
7169
# TODO: radevika: Update once the common project is merged.
7270
mcp_server_configs = await self.config_service.list_tool_servers(
73-
agent_user_id=agent_user_id, environment_id=environment_id, auth_token=auth_token
71+
agent_user_id=agent_user_id, auth_token=auth_token
7472
)
7573

7674
# Convert MCP server configs to MCPServerInfo objects
@@ -114,8 +112,6 @@ async def add_tool_servers_to_agent(
114112
headers = si.headers or {}
115113
if auth_token:
116114
headers["Authorization"] = f"Bearer {auth_token}"
117-
if environment_id:
118-
headers["x-ms-environment-id"] = environment_id
119115

120116
# Create MCPServerStreamableHttpParams with proper configuration
121117
params = MCPServerStreamableHttpParams(url=si.url, headers=headers)

libraries/microsoft-agents-a365-tooling-extensions-semantickernel/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ registration_service = McpToolRegistrationService()
5656
await registration_service.add_tool_servers_to_kernel(
5757
kernel=kernel,
5858
agent_user_id="user-123",
59-
environment_id="prod",
6059
auth_token="your-auth-token"
6160
)
6261
```

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

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ async def add_tool_servers_to_agent(
8484
self,
8585
kernel: sk.Kernel,
8686
agent_user_id: str,
87-
environment_id: str,
8887
auth: Authorization,
8988
context: TurnContext,
9089
auth_token: Optional[str] = None,
@@ -95,7 +94,6 @@ async def add_tool_servers_to_agent(
9594
Args:
9695
kernel: The Semantic Kernel instance to which the tools will be added.
9796
agent_user_id: Agent User ID for the agent.
98-
environment_id: Environment ID for the environment.
9997
auth_token: Authentication token to access the MCP servers.
10098
10199
Raises:
@@ -108,7 +106,7 @@ async def add_tool_servers_to_agent(
108106
authToken = await auth.exchange_token(context, scopes, "AGENTIC")
109107
auth_token = authToken.token
110108

111-
self._validate_inputs(kernel, agent_user_id, environment_id, auth_token)
109+
self._validate_inputs(kernel, agent_user_id, auth_token)
112110

113111
if self._mcp_server_configuration_service is None:
114112
raise ValueError(
@@ -117,7 +115,7 @@ async def add_tool_servers_to_agent(
117115

118116
# Get and process servers
119117
servers = await self._mcp_server_configuration_service.list_tool_servers(
120-
agent_user_id, environment_id, auth_token
118+
agent_user_id, auth_token
121119
)
122120
self._logger.info(f"🔧 Adding MCP tools from {len(servers)} servers")
123121

@@ -134,16 +132,12 @@ async def add_tool_servers_to_agent(
134132
headers = {}
135133

136134
if tools_mode == "MockMCPServer":
137-
# Mock server does not require bearer auth, but still forward environment id if available.
138-
if environment_id:
139-
headers[Constants.Headers.ENVIRONMENT_ID] = environment_id
140-
135+
# Use mock authorization header if provided
141136
if mock_auth_header := os.getenv("MOCK_MCP_AUTHORIZATION"):
142137
headers[Constants.Headers.AUTHORIZATION] = mock_auth_header
143138
else:
144139
headers = {
145140
Constants.Headers.AUTHORIZATION: f"{Constants.Headers.BEARER_PREFIX} {auth_token}",
146-
Constants.Headers.ENVIRONMENT_ID: environment_id,
147141
}
148142

149143
plugin = MCPStreamableHttpPlugin(
@@ -178,15 +172,13 @@ async def add_tool_servers_to_agent(
178172
# ============================================================================
179173

180174
def _validate_inputs(
181-
self, kernel: Any, agent_user_id: str, environment_id: str, auth_token: str
175+
self, kernel: Any, agent_user_id: str, auth_token: str
182176
) -> None:
183177
"""Validate all required inputs."""
184178
if kernel is None:
185179
raise ValueError("kernel cannot be None")
186180
if not agent_user_id or not agent_user_id.strip():
187181
raise ValueError("agent_user_id cannot be null or empty")
188-
if not environment_id or not environment_id.strip():
189-
raise ValueError("environment_id cannot be null or empty")
190182
if not auth_token or not auth_token.strip():
191183
raise ValueError("auth_token cannot be null or empty")
192184

libraries/microsoft-agents-a365-tooling/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ mcp_config = MCPServerConfig(
5959
config_service = McpToolServerConfigurationService()
6060
mcp_servers = await config_service.list_tool_servers(
6161
agent_user_id="agent-123",
62-
environment_id="prod",
6362
auth_token="your-auth-token"
6463
)
6564
```

0 commit comments

Comments
 (0)