File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,29 @@ async def test_create_server(self):
30
30
mcp = FastMCP ()
31
31
assert mcp .name == "FastMCP"
32
32
33
+ @pytest .mark .anyio
34
+ async def test_non_ascii_description (self ):
35
+ """Test that FastMCP handles non-ASCII characters in descriptions correctly"""
36
+ mcp = FastMCP ()
37
+
38
+ @mcp .tool (description = "🌟 This tool uses emojis and UTF-8 characters: á é í ó ú ñ 漢字 🎉" )
39
+ def hello_world (name : str = "世界" ) -> str :
40
+ return f"¡Hola, { name } ! 👋"
41
+
42
+ async with client_session (mcp ._mcp_server ) as client :
43
+ tools = await client .list_tools ()
44
+ assert len (tools .tools ) == 1
45
+ tool = tools .tools [0 ]
46
+ assert "🌟" in tool .description
47
+ assert "漢字" in tool .description
48
+ assert "🎉" in tool .description
49
+
50
+ result = await client .call_tool ("hello_world" , {})
51
+ assert len (result .content ) == 1
52
+ content = result .content [0 ]
53
+ assert isinstance (content , TextContent )
54
+ assert "¡Hola, 世界! 👋" == content .text
55
+
33
56
@pytest .mark .anyio
34
57
async def test_add_tool_decorator (self ):
35
58
mcp = FastMCP ()
You can’t perform that action at this time.
0 commit comments