Skip to content

Commit d4da1bb

Browse files
wukathcopybara-github
authored andcommitted
fix: Initialize self._auth_config inside BaseAuthenticatedTool
So that we can access self._auth_config in McpTool for getting auth headers Co-authored-by: Kathy Wu <[email protected]> PiperOrigin-RevId: 856451693
1 parent cce430d commit d4da1bb

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/google/adk/tools/base_authenticated_tool.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def __init__(
6666
name=name,
6767
description=description,
6868
)
69+
self._auth_config = auth_config
6970

7071
if auth_config and auth_config.auth_scheme:
7172
self._credentials_manager = CredentialManager(auth_config=auth_config)

tests/unittests/tools/test_base_authenticated_tool.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ def test_init_with_auth_config(self):
9090
assert tool.description == "Test description"
9191
assert tool._credentials_manager is not None
9292
assert tool._response_for_auth_required == unauthenticated_response
93+
assert tool._auth_config == auth_config
9394

9495
def test_init_with_no_auth_config(self):
9596
"""Test initialization without auth_config."""
@@ -99,6 +100,7 @@ def test_init_with_no_auth_config(self):
99100
assert tool.description == "Test authenticated tool"
100101
assert tool._credentials_manager is None
101102
assert tool._response_for_auth_required is None
103+
assert tool._auth_config is None
102104

103105
def test_init_with_empty_auth_scheme(self):
104106
"""Test initialization with auth_config but no auth_scheme."""

0 commit comments

Comments
 (0)