Skip to content

Commit ed19cfd

Browse files
refactor: consolidate all list method cursor tests into one file
- Move list_tools test into test_list_methods_cursor.py - Remove redundant test_list_tools_cursor.py file - All cursor pagination tests are now in one place
1 parent d8cec61 commit ed19cfd

File tree

2 files changed

+37
-46
lines changed

2 files changed

+37
-46
lines changed

tests/client/test_list_methods_cursor.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,43 @@
99
pytestmark = pytest.mark.anyio
1010

1111

12+
async def test_list_tools_cursor_parameter():
13+
"""Test that the cursor parameter is accepted for list_tools.
14+
15+
Note: FastMCP doesn't currently implement pagination, so this test
16+
only verifies that the cursor parameter is accepted by the client.
17+
"""
18+
server = FastMCP("test")
19+
20+
# Create a couple of test tools
21+
@server.tool(name="test_tool_1")
22+
async def test_tool_1() -> str:
23+
"""First test tool"""
24+
return "Result 1"
25+
26+
@server.tool(name="test_tool_2")
27+
async def test_tool_2() -> str:
28+
"""Second test tool"""
29+
return "Result 2"
30+
31+
async with create_session(server._mcp_server) as client_session:
32+
# Test without cursor parameter (omitted)
33+
result1 = await client_session.list_tools()
34+
assert len(result1.tools) == 2
35+
36+
# Test with cursor=None
37+
result2 = await client_session.list_tools(cursor=None)
38+
assert len(result2.tools) == 2
39+
40+
# Test with cursor as string
41+
result3 = await client_session.list_tools(cursor="some_cursor_value")
42+
assert len(result3.tools) == 2
43+
44+
# Test with empty string cursor
45+
result4 = await client_session.list_tools(cursor="")
46+
assert len(result4.tools) == 2
47+
48+
1249
async def test_list_resources_cursor_parameter():
1350
"""Test that the cursor parameter is accepted for list_resources.
1451

tests/client/test_list_tools_cursor.py

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)