Skip to content

Commit 304a626

Browse files
committed
applied autoformat.sh
1 parent 4c01b00 commit 304a626

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/google/adk/tools/mcp_tool/mcp_toolset.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
from .mcp_tool import MCPTool
4848
from .types import HeaderProvider
4949

50-
5150
logger = logging.getLogger("google_adk." + __name__)
5251

5352

@@ -67,9 +66,9 @@ def _validate_header_value(
6766
if not isinstance(value, (str, int, float, bool)):
6867
msg = (
6968
f'Value for state key "{state_key}" is of type'
70-
f' {type(value).__name__}, which may not serialize correctly into a'
71-
' header. Consider pre-serializing complex values or using'
72-
' state_header_format.'
69+
f" {type(value).__name__}, which may not serialize correctly into a"
70+
" header. Consider pre-serializing complex values or using"
71+
" state_header_format."
7372
)
7473
if strict:
7574
raise ValueError(msg)

tests/unittests/tools/mcp_tool/test_jwt_token_propagation.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,19 +143,22 @@ def test_empty_string_value_returns_empty(self):
143143
def test_strict_mode_with_primitive_types(self):
144144
"""Test that strict mode works properly with primitive types."""
145145
mock_context = Mock(spec=ReadonlyContext)
146-
146+
147147
# Test with string
148148
mock_context.state = {"token": "my-token"}
149149
provider = create_session_state_header_provider(
150150
state_key="token", strict=True
151151
)
152152
headers = provider(mock_context)
153153
assert headers == {"Authorization": "Bearer my-token"}
154-
154+
155155
# Test with int
156156
mock_context.state = {"count": 42}
157157
provider = create_session_state_header_provider(
158-
state_key="count", header_name="X-Count", header_format="{value}", strict=True
158+
state_key="count",
159+
header_name="X-Count",
160+
header_format="{value}",
161+
strict=True,
159162
)
160163
headers = provider(mock_context)
161164
assert headers == {"X-Count": "42"}
@@ -171,13 +174,12 @@ def test_strict_mode_raises_on_non_primitive_types(self):
171174

172175
with pytest.raises(ValueError) as exc_info:
173176
provider(mock_context)
174-
177+
175178
assert "complex_data" in str(exc_info.value)
176179
assert "dict" in str(exc_info.value)
177180
assert "may not serialize correctly" in str(exc_info.value)
178181

179182

180-
181183
class TestMcpToolsetConfigStateHeaderMapping:
182184
"""Test suite for state_header_mapping configuration."""
183185

@@ -341,4 +343,3 @@ def test_from_config_with_strict_mode(self):
341343

342344
assert "data" in str(exc_info.value)
343345
assert "dict" in str(exc_info.value)
344-

0 commit comments

Comments
 (0)