Skip to content

Commit c617269

Browse files
committed
fix: resolve pyright type errors in pagination test mocks
Replace **kwargs: object with explicit meta and cache_mode parameters matching the list_tools signature to satisfy pyright strict checking. Fixes CI pyright failure on PR #3156 Signed-off-by: dongjiang <dongjiang1989@126.com>
1 parent db9225b commit c617269

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

‎tests/client/test_list_all_pagination.py‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
ListResourcesResult,
99
ListResourceTemplatesResult,
1010
ListToolsResult,
11+
RequestParamsMeta,
1112
)
1213

14+
from mcp.client.caching import CacheMode
1315
from mcp.client.client import Client, CursorCycleError, PaginationExceededError
1416
from mcp.server.mcpserver import MCPServer
1517

@@ -126,10 +128,15 @@ def dummy() -> str: # pragma: no cover
126128
original = client.list_tools
127129
call_count = 0
128130

129-
async def infinite_list_tools(*, cursor: str | None = None, **kwargs: object) -> ListToolsResult:
131+
async def infinite_list_tools(
132+
*,
133+
cursor: str | None = None,
134+
meta: RequestParamsMeta | None = None,
135+
cache_mode: CacheMode = "use",
136+
) -> ListToolsResult:
130137
nonlocal call_count
131138
call_count += 1
132-
result = await original(cursor=cursor, **kwargs)
139+
result = await original(cursor=cursor, meta=meta, cache_mode=cache_mode)
133140
result.next_cursor = f"cursor-{call_count}"
134141
return result
135142

@@ -154,10 +161,15 @@ def dummy() -> str: # pragma: no cover
154161
cursors_seq = ["cursorA", "cursorB", "cursorA", "cursorA", "cursorA"]
155162
call_count = 0
156163

157-
async def cycling_list_tools(*, cursor: str | None = None, **kwargs: object) -> ListToolsResult:
164+
async def cycling_list_tools(
165+
*,
166+
cursor: str | None = None,
167+
meta: RequestParamsMeta | None = None,
168+
cache_mode: CacheMode = "use",
169+
) -> ListToolsResult:
158170
nonlocal call_count
159171
call_count += 1
160-
result = await original(cursor=cursor, **kwargs)
172+
result = await original(cursor=cursor, meta=meta, cache_mode=cache_mode)
161173
result.next_cursor = cursors_seq[call_count - 1] # pragma: no branch
162174
return result
163175

0 commit comments

Comments
 (0)