Skip to content

Commit d211763

Browse files
committed
applied autoformat.sh
1 parent e23bd01 commit d211763

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
@@ -60,7 +60,6 @@
6060
from .mcp_tool import MCPTool
6161
from .types import HeaderProvider
6262

63-
6463
logger = logging.getLogger("google_adk." + __name__)
6564

6665

@@ -80,9 +79,9 @@ def _validate_header_value(
8079
if not isinstance(value, (str, int, float, bool)):
8180
msg = (
8281
f'Value for state key "{state_key}" is of type'
83-
f' {type(value).__name__}, which may not serialize correctly into a'
84-
' header. Consider pre-serializing complex values or using'
85-
' state_header_format.'
82+
f" {type(value).__name__}, which may not serialize correctly into a"
83+
" header. Consider pre-serializing complex values or using"
84+
" state_header_format."
8685
)
8786
if strict:
8887
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)