@@ -20,19 +20,21 @@ async def test_list_roots_callback():
20
20
21
21
server = FastMCP ("test" )
22
22
23
- callback_return = ListRootsResult (roots = [
24
- Root (
25
- uri = FileUrl ("file://users/fake/test" ),
26
- name = "Test Root 1" ,
27
- ),
28
- Root (
29
- uri = FileUrl ("file://users/fake/test/2" ),
30
- name = "Test Root 2" ,
31
- )
32
- ])
23
+ callback_return = ListRootsResult (
24
+ roots = [
25
+ Root (
26
+ uri = FileUrl ("file://users/fake/test" ),
27
+ name = "Test Root 1" ,
28
+ ),
29
+ Root (
30
+ uri = FileUrl ("file://users/fake/test/2" ),
31
+ name = "Test Root 2" ,
32
+ ),
33
+ ]
34
+ )
33
35
34
36
async def list_roots_callback (
35
- context : RequestContext [ClientSession , None ]
37
+ context : RequestContext [ClientSession , None ],
36
38
) -> ListRootsResult :
37
39
return callback_return
38
40
@@ -52,7 +54,7 @@ async def test_list_roots(context: Context, message: str):
52
54
)
53
55
assert result .isError is False
54
56
assert isinstance (result .content [0 ], TextContent )
55
- assert result .content [0 ].text == ' true'
57
+ assert result .content [0 ].text == " true"
56
58
57
59
# Test without list_roots callback
58
60
async with create_session (server ._mcp_server ) as client_session :
@@ -62,5 +64,7 @@ async def test_list_roots(context: Context, message: str):
62
64
)
63
65
assert result .isError is True
64
66
assert isinstance (result .content [0 ], TextContent )
65
- assert result .content [0 ].text == 'Error executing tool test_list_roots: List roots not supported'
66
-
67
+ assert (
68
+ result .content [0 ].text
69
+ == "Error executing tool test_list_roots: List roots not supported"
70
+ )
0 commit comments