FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-sdk/examples/mcpserver/unicode_example.py at main · evalstate/python-sdk · GitHub
evalstate
/
python-sdk
Public
forked from
modelcontextprotocol/python-sdk
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Pull requests
1
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-sdk
/
examples
/
mcpserver
/
unicode_example.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
59 lines (49 loc) · 1.81 KB
Breadcrumbs
python-sdk
/
examples
/
mcpserver
/
unicode_example.py
Copy path
File metadata and controls
59 lines (49 loc) · 1.81 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
"""Example MCPServer server that uses Unicode characters in various places to help test
Unicode handling in tools and inspectors.
"""
from
mcp
.
server
.
mcpserver
import
MCPServer
mcp
=
MCPServer
()
@
mcp
.
tool
(
description
=
"🌟 A tool that uses various Unicode characters in its description: á é í ó ú ñ 漢字 🎉"
)
def
hello_unicode
(
name
:
str
=
"世界"
,
greeting
:
str
=
"¡Hola"
)
->
str
:
"""A simple tool that demonstrates Unicode handling in:
- Tool description (emojis, accents, CJK characters)
- Parameter defaults (CJK characters)
- Return values (Spanish punctuation, emojis)
"""
return
f"
{
greeting
}
,
{
name
}
! 👋"
@
mcp
.
tool
(
description
=
"🎨 Tool that returns a list of emoji categories"
)
def
list_emoji_categories
()
->
list
[
str
]:
"""Returns a list of emoji categories with emoji examples."""
return
[
"😀 Smileys & Emotion"
,
"👋 People & Body"
,
"🐶 Animals & Nature"
,
"🍎 Food & Drink"
,
"⚽ Activities"
,
"🌍 Travel & Places"
,
"💡 Objects"
,
"❤️ Symbols"
,
"🚩 Flags"
,
]
@
mcp
.
tool
(
description
=
"🔤 Tool that returns text in different scripts"
)
def
multilingual_hello
()
->
str
:
"""Returns hello in different scripts and writing systems."""
return
"
\n
"
.
join
(
[
"English: Hello!"
,
"Spanish: ¡Hola!"
,
"French: Bonjour!"
,
"German: Grüß Gott!"
,
"Russian: Привет!"
,
"Greek: Γεια σας!"
,
"Hebrew: !שָׁלוֹם"
,
"Arabic: !مرحبا"
,
"Hindi: नमस्ते!"
,
"Chinese: 你好!"
,
"Japanese: こんにちは!"
,
"Korean: 안녕하세요!"
,
"Thai: สวัสดี!"
,
]
)
if
__name__
==
"__main__"
:
mcp
.
run
()
Back
|
FazBrowse Home
|
New Git URL