Skip to content

Commit 7837a03

Browse files
timof1308timo-fischer
authored andcommitted
applied autoformat.sh
1 parent 62f286f commit 7837a03

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
from .mcp_tool import MCPTool
5151
from .types import HeaderProvider
5252

53-
5453
logger = logging.getLogger("google_adk." + __name__)
5554

5655

@@ -70,9 +69,9 @@ def _validate_header_value(
7069
if not isinstance(value, (str, int, float, bool)):
7170
msg = (
7271
f'Value for state key "{state_key}" is of type'
73-
f' {type(value).__name__}, which may not serialize correctly into a'
74-
' header. Consider pre-serializing complex values or using'
75-
' state_header_format.'
72+
f" {type(value).__name__}, which may not serialize correctly into a"
73+
" header. Consider pre-serializing complex values or using"
74+
" state_header_format."
7675
)
7776
if strict:
7877
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)