@@ -281,10 +281,12 @@ async def get_user_auth(
281281 self ._config .timeout ,
282282 self ._token_cache ,
283283 )
284- return AuthResult (
284+ result = AuthResult (
285285 access_token = token ,
286286 gateway_url = credentials .gateway_url ,
287287 )
288+ logger .info ("User auth token obtained — gateway: '%s'" , result .gateway_url )
289+ return result
288290
289291 # Check for transparent mode
290292 if detect_transparent_credentials ():
@@ -299,10 +301,12 @@ async def get_user_auth(
299301 self ._config .timeout ,
300302 self ._token_cache ,
301303 )
302- return AuthResult (
304+ result = AuthResult (
303305 access_token = token ,
304306 gateway_url = credentials .gateway_url ,
305307 )
308+ logger .info ("User auth token obtained — gateway: '%s'" , result .gateway_url )
309+ return result
306310
307311 tenant = self ._resolve_tenant_subdomain ()
308312 token , gateway_url = await fetch_user_auth (
@@ -311,7 +315,9 @@ async def get_user_auth(
311315 token_cache = self ._token_cache ,
312316 gateway_url_cache = self ._gateway_url_cache ,
313317 )
314- return AuthResult (access_token = token , gateway_url = gateway_url )
318+ result = AuthResult (access_token = token , gateway_url = gateway_url )
319+ logger .info ("User auth token obtained — gateway: '%s'" , result .gateway_url )
320+ return result
315321
316322 except AgentGatewaySDKError :
317323 raise
@@ -437,10 +443,6 @@ async def list_mcp_tools(
437443
438444 # LoB flow - requires tenant_subdomain
439445 tenant = self ._resolve_tenant_subdomain ()
440- if user_token :
441- auth = await self .get_user_auth (user_token )
442- else :
443- auth = await self .get_system_auth ()
444446 return await get_mcp_tools_lob (
445447 tenant ,
446448 auth .access_token ,
@@ -590,7 +592,10 @@ async def call_mcp_tool(
590592 tool , auth .access_token , self ._config .timeout , ** kwargs
591593 )
592594
593- auth = await self .get_user_auth (user_token )
595+ if not user_token :
596+ raise AgentGatewaySDKError (
597+ "user_token is required for LoB tool invocation."
598+ )
594599 return await call_mcp_tool_lob (
595600 tool , auth .access_token , self ._config .timeout , ** kwargs
596601 )
0 commit comments