File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed
src/google/adk/tools/mcp_tool
tests/unittests/tools/mcp_tool Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change 3232from typing import TextIO
3333from typing import Union
3434
35+ import httpx
3536from mcp import ClientSession
3637from mcp import StdioServerParameters
3738from mcp .client .sse import sse_client
4849
4950
5051def create_mcp_http_client (
51- headers = None ,
52- timeout = None ,
53- auth = None ,
54- ):
52+ headers : dict [ str , str ] | None = None ,
53+ timeout : httpx . Timeout | None = None ,
54+ auth : httpx . Auth | None = None ,
55+ ) -> httpx . AsyncClient :
5556 """Creates MCP HTTP client and instruments it when OTel is available."""
5657 client = _create_mcp_http_client (
5758 headers = headers ,
Original file line number Diff line number Diff line change 1313# limitations under the License.
1414
1515import asyncio
16+ import builtins
1617from datetime import timedelta
1718import hashlib
1819from io import StringIO
1920import json
2021import sys
21- import builtins
2222from unittest .mock import ANY
2323from unittest .mock import AsyncMock
2424from unittest .mock import Mock
@@ -193,7 +193,9 @@ def test_init_with_streamable_http_default_httpx_factory(
193193 ].get_default (),
194194 )
195195
196- @patch ("google.adk.tools.mcp_tool.mcp_session_manager._create_mcp_http_client" )
196+ @patch (
197+ "google.adk.tools.mcp_tool.mcp_session_manager._create_mcp_http_client"
198+ )
197199 def test_default_httpx_factory_instruments_client_when_available (
198200 self , mock_base_factory
199201 ):
@@ -215,7 +217,9 @@ def test_default_httpx_factory_instruments_client_when_available(
215217 assert result is client
216218 mock_instrumentor .instrument_client .assert_called_once_with (client )
217219
218- @patch ("google.adk.tools.mcp_tool.mcp_session_manager._create_mcp_http_client" )
220+ @patch (
221+ "google.adk.tools.mcp_tool.mcp_session_manager._create_mcp_http_client"
222+ )
219223 def test_default_httpx_factory_handles_missing_opentelemetry (
220224 self , mock_base_factory
221225 ):
You can’t perform that action at this time.
0 commit comments