Skip to content

Commit 3dd83fe

Browse files
committed
Remove cross-platform references from comments and docstrings
- mcp_tool_server_configuration_service.py: replace 'mirrors Node.js behaviour' and 'aligns with Node.js' with self-contained descriptions - utility.py: rephrase is_development_environment() docstring to describe env var precedence without mentioning .NET (ASPNETCORE_ENVIRONMENT and DOTNET_ENVIRONMENT variable names are kept, only the platform labels are removed) - test_mcp_server_configuration.py: remove reference to non-existent MCP_PLATFORM_APP_ID env var in test section header and docstring; replace with accurate guidance pointing to MCP_PLATFORM_AUTHENTICATION_SCOPE / MCP_PLATFORM_ENDPOINT as the actual configurable inputs
1 parent 9ef600e commit 3dd83fe

3 files changed

Lines changed: 16 additions & 17 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ async def list_tool_servers(
170170
else:
171171
# Legacy call without auth context — guard against V2 servers.
172172
# V2 servers require per-audience OBO exchange; returning them without a
173-
# token would cause silent 401s downstream. Raise early with a clear message
174-
# so callers get an actionable migration hint (mirrors Node.js behaviour).
173+
# token would cause silent 401s downstream. Raise early with a clear
174+
# migration hint so callers know which parameters to add.
175175
v2_servers = [s for s in servers if self._is_v2_server(s)]
176176
if v2_servers:
177177
names = ", ".join(
@@ -226,7 +226,7 @@ def _create_dev_token_acquirer(self) -> TokenAcquirer:
226226
The CLI (``a365 develop get-token``) writes tokens to the environment before the agent
227227
starts. Resolution order per server:
228228
229-
1. ``BEARER_TOKEN_<MCP_SERVER_NAME_UPPER>`` — per-server token (aligns with Node.js)
229+
1. ``BEARER_TOKEN_<MCP_SERVER_NAME_UPPER>`` — per-server token
230230
2. ``BEARER_TOKEN`` — shared fallback token
231231
232232
Tokens are returned **without** a ``Bearer `` prefix. If the env var already contains

libraries/microsoft-agents-a365-tooling/microsoft_agents_a365/tooling/utils/utility.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ def is_development_environment() -> bool:
7575
Resolution order (first non-empty value wins):
7676
1. ``PYTHON_ENVIRONMENT`` — explicit Python SDK variable used in current samples.
7777
2. ``ENVIRONMENT`` — legacy Python SDK variable (backward compatibility).
78-
3. ``ASPNETCORE_ENVIRONMENT`` — .NET / Azure hosting convention.
79-
4. ``DOTNET_ENVIRONMENT`` — .NET generic-host convention.
78+
3. ``ASPNETCORE_ENVIRONMENT`` — Azure hosting convention.
79+
4. ``DOTNET_ENVIRONMENT`` — generic-host convention.
8080
5. Defaults to ``"Development"`` when none of the above are set.
8181
82-
``PYTHON_ENVIRONMENT`` and ``ENVIRONMENT`` are checked before the .NET variables
83-
so legacy Python agents that set ``ENVIRONMENT=Production`` are not affected if an
84-
unrelated process also sets ``ASPNETCORE_ENVIRONMENT`` (e.g. a .NET sidecar).
82+
``PYTHON_ENVIRONMENT`` and ``ENVIRONMENT`` are checked first so that agents
83+
which explicitly set ``ENVIRONMENT=Production`` are not affected if a host
84+
process also sets ``ASPNETCORE_ENVIRONMENT``.
8585
8686
Returns:
8787
bool: True when the resolved environment is "development" (case-insensitive).

tests/tooling/test_mcp_server_configuration.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -288,20 +288,19 @@ def test_v1_atg_audience_in_uri_form_falls_back_to_atg_scope(self):
288288
assert resolve_token_scope_for_server(server) == f"{self.PROD_ATG_APP_ID}/.default"
289289

290290
# ------------------------------------------------------------------
291-
# V1 test-env — ATG_APP_ID overridden via MCP_PLATFORM_APP_ID
291+
# V1 test-env — non-prod ATG audience falls through to V2 scope resolution
292292
# ------------------------------------------------------------------
293293

294294
def test_v1_test_env_shared_audience_not_treated_as_v2(self):
295-
"""V1 test env: test audience GUID is a different GUID from prod ATG — treated as V2
296-
unless the caller configures ATG_APP_ID to match. This test documents that the SDK
297-
uses the prod ATG_APP_ID constant; test environments must set MCP_PLATFORM_APP_ID
298-
via the CLI / .env so gateway returns the correct shared audience in discovery."""
295+
"""Non-prod ATG audience GUID is different from the hardcoded prod ATG_APP_ID constant,
296+
so it is classified as V2 and resolved to its own /.default scope. This is intentional:
297+
the V2 token exchange works correctly for test app registrations because
298+
Tools.ListInvoke.All is pre-consented. Use MCP_PLATFORM_AUTHENTICATION_SCOPE or
299+
MCP_PLATFORM_ENDPOINT env vars to point the SDK at a non-prod gateway."""
299300
from microsoft_agents_a365.tooling.utils.utility import resolve_token_scope_for_server
300301

301-
# test env audience is a different GUID — with prod ATG_APP_ID hardcoded,
302-
# it is treated as V2 (resolved to its own /.default scope).
303-
# This is intentional: V2 logic handles it correctly since Tools.ListInvoke.All
304-
# is pre-consented on the test app registration.
302+
# Non-prod ATG audience — classified as V2 because it does not match
303+
# the hardcoded prod ATG_APP_ID constant. Resolved to its own /.default scope.
305304
server = self._make_server(audience=self.TEST_ATG_APP_ID, scope=None)
306305
assert resolve_token_scope_for_server(server) == f"{self.TEST_ATG_APP_ID}/.default"
307306

0 commit comments

Comments
 (0)