Skip to content

Commit ee56fff

Browse files
committed
autofix code style issues
1 parent b2fb395 commit ee56fff

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

mcp_client.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,9 @@ async def list_tools_from_server(workload: dict[str, Any]) -> dict[str, Any]:
170170
# ToolHive can proxy servers via SSE even if the original transport is stdio
171171
if proxy_mode == "sse":
172172
# Use SSE client for SSE proxy
173-
async with sse_client(url, httpx_client_factory=_create_tolerant_httpx_client) as (read, write):
173+
async with sse_client(
174+
url, httpx_client_factory=_create_tolerant_httpx_client
175+
) as (read, write):
174176
async with ClientSession(read, write) as session:
175177
await session.initialize()
176178
tools_response = await session.list_tools()
@@ -309,7 +311,9 @@ async def get_tool_details_from_server(
309311

310312
# Connect and list tools to find the requested tool
311313
if proxy_mode == "sse":
312-
async with sse_client(url, httpx_client_factory=_create_tolerant_httpx_client) as (read, write):
314+
async with sse_client(
315+
url, httpx_client_factory=_create_tolerant_httpx_client
316+
) as (read, write):
313317
async with ClientSession(read, write) as session:
314318
await session.initialize()
315319
tools_response = await session.list_tools()
@@ -416,7 +420,9 @@ async def call_tool(
416420

417421
# Connect and call the tool with timeout
418422
if proxy_mode == "sse":
419-
async with sse_client(url, httpx_client_factory=_create_tolerant_httpx_client) as (read, write):
423+
async with sse_client(
424+
url, httpx_client_factory=_create_tolerant_httpx_client
425+
) as (read, write):
420426
async with ClientSession(read, write) as session:
421427
await session.initialize()
422428
result = await asyncio.wait_for(
@@ -544,7 +550,9 @@ async def execute_calls(session):
544550
raise RuntimeError("\n".join(error_parts)) from e
545551

546552
if proxy_mode == "sse":
547-
async with sse_client(url, httpx_client_factory=_create_tolerant_httpx_client) as (read, write):
553+
async with sse_client(
554+
url, httpx_client_factory=_create_tolerant_httpx_client
555+
) as (read, write):
548556
async with ClientSession(read, write) as session:
549557
await session.initialize()
550558
await execute_calls(session)

toolhive_client.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,11 @@ async def _is_toolhive_available(
6565
"""
6666
try:
6767
async with httpx.AsyncClient(timeout=timeout) as client:
68-
response = await client.get(
69-
f"http://{host}:{port}/api/v1beta/version"
70-
)
68+
response = await client.get(f"http://{host}:{port}/api/v1beta/version")
7169
response.raise_for_status()
7270
data = response.json()
7371
except (httpx.HTTPError, OSError) as e:
74-
raise ConnectionError(
75-
f"ToolHive not available at {host}:{port}: {e}"
76-
)
72+
raise ConnectionError(f"ToolHive not available at {host}:{port}: {e}")
7773

7874
if not isinstance(data, dict) or "version" not in data:
7975
raise ConnectionError(
@@ -117,9 +113,7 @@ async def _scan_for_toolhive_async(
117113
)
118114

119115
found_ports = [
120-
result
121-
for result in task_outcomes
122-
if not isinstance(result, BaseException)
116+
result for result in task_outcomes if not isinstance(result, BaseException)
123117
]
124118

125119
if found_ports:
@@ -186,9 +180,7 @@ async def discover_toolhive_async(
186180
if not found:
187181
# Fall back to scanning
188182
print(f"Port {port} not available, scanning for ToolHive...")
189-
port = await _scan_for_toolhive_async(
190-
host, scan_port_start, scan_port_end
191-
)
183+
port = await _scan_for_toolhive_async(host, scan_port_start, scan_port_end)
192184
else:
193185
# Scan for ToolHive with host fallbacks
194186
scan_hosts = [host]

0 commit comments

Comments
 (0)