Skip to content

Commit d0f5279

Browse files
Fix pyright errors in Client and tests
1 parent 5f4925c commit d0f5279

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

src/mcp/client/client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ async def list_resources(
193193
if params is not None:
194194
return await self.session.list_resources(params=params)
195195
elif cursor is not None:
196-
return await self.session.list_resources(cursor)
196+
return await self.session.list_resources(cursor) # pyright: ignore[reportDeprecated]
197197
else:
198198
return await self.session.list_resources()
199199

@@ -216,7 +216,7 @@ async def list_resource_templates(
216216
if params is not None:
217217
return await self.session.list_resource_templates(params=params)
218218
elif cursor is not None:
219-
return await self.session.list_resource_templates(cursor)
219+
return await self.session.list_resource_templates(cursor) # pyright: ignore[reportDeprecated]
220220
else:
221221
return await self.session.list_resource_templates()
222222

@@ -289,7 +289,7 @@ async def list_prompts(
289289
if params is not None:
290290
return await self.session.list_prompts(params=params)
291291
elif cursor is not None:
292-
return await self.session.list_prompts(cursor)
292+
return await self.session.list_prompts(cursor) # pyright: ignore[reportDeprecated]
293293
else:
294294
return await self.session.list_prompts()
295295

@@ -352,7 +352,7 @@ async def list_tools(
352352
if params is not None:
353353
return await self.session.list_tools(params=params)
354354
elif cursor is not None:
355-
return await self.session.list_tools(cursor)
355+
return await self.session.list_tools(cursor) # pyright: ignore[reportDeprecated]
356356
else:
357357
return await self.session.list_tools()
358358

tests/client/test_client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import pytest
44
from pydantic import AnyUrl
55

6+
import mcp.types as types
67
from mcp.client.client import Client
78
from mcp.server import Server
89
from mcp.server.fastmcp import FastMCP
@@ -201,9 +202,9 @@ class TestClientCallbacks:
201202
@pytest.mark.anyio
202203
async def test_logging_callback(self, fastmcp_server: FastMCP):
203204
"""Test that logging callback is called."""
204-
log_messages = []
205+
log_messages: list[types.LoggingMessageNotificationParams] = []
205206

206-
async def logging_callback(params):
207+
async def logging_callback(params: types.LoggingMessageNotificationParams) -> None:
207208
log_messages.append(params)
208209

209210
async with Client(

tests/client/transports/test_memory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,5 +109,5 @@ async def test_raise_exceptions(self, fastmcp_server: FastMCP):
109109
"""Test that raise_exceptions parameter is passed through."""
110110
transport = InMemoryTransport(fastmcp_server, raise_exceptions=True)
111111
# Just verify the transport can be created with the parameter
112-
async with transport.connect() as (read_stream, write_stream):
112+
async with transport.connect() as (read_stream, _write_stream):
113113
assert read_stream is not None

0 commit comments

Comments
 (0)