@@ -26,9 +26,7 @@ async def demo_get_current_user(client: Client) -> None:
2626 username = user_info .get ("username" , "N/A" )
2727 email = user_info .get ("email" , "N/A" )
2828 authenticated = user_info .get ("authenticated" , "N/A" )
29- print (
30- f" • Result: Username={ username } , Email={ email } , Authenticated={ authenticated } "
31- )
29+ print (f" • Result: Username={ username } , Email={ email } , Authenticated={ authenticated } " )
3230 else :
3331 print (" • Result: No user information retrieved" )
3432 print ()
@@ -37,9 +35,7 @@ async def demo_get_current_user(client: Client) -> None:
3735async def demo_search_models (client : Client ) -> None :
3836 """Demo: Search models using various parameters."""
3937 print ("2. 🛠️ Tool: search_models" )
40- print (
41- " • Task: 🔍 Search text-generation models (keyword='DeepSeek', support inference, limit 3 results)"
42- )
38+ print (" • Task: 🔍 Search text-generation models (keyword='DeepSeek', support inference, limit 3 results)" )
4339
4440 result = await client .call_tool (
4541 "search_models" ,
@@ -68,9 +64,7 @@ async def demo_search_models(client: Client) -> None:
6864async def demo_search_papers (client : Client ) -> None :
6965 """Demo: Search papers using query."""
7066 print ("3. 🛠️ Tool: search_papers" )
71- print (
72- " • Task: 📚 Search academic papers (keyword='Qwen3', sort='hot', limit 1 result)"
73- )
67+ print (" • Task: 📚 Search academic papers (keyword='Qwen3', sort='hot', limit 1 result)" )
7468
7569 result = await client .call_tool (
7670 "search_papers" ,
@@ -85,9 +79,7 @@ async def demo_search_papers(client: Client) -> None:
8579 authors = paper .get ("authors" , "N/A" )
8680 arxiv_id = paper .get ("arxiv_id" , "N/A" )
8781 views = paper .get ("view_count" , 0 )
88- print (
89- f" • Result: '{ title } ' Authors={ authors } , ArXiv ID={ arxiv_id } , Views={ views :,} "
90- )
82+ print (f" • Result: '{ title } ' Authors={ authors } , ArXiv ID={ arxiv_id } , Views={ views :,} " )
9183 else :
9284 print (" • Result: No papers found" )
9385 else :
@@ -98,9 +90,7 @@ async def demo_search_papers(client: Client) -> None:
9890async def demo_search_mcp_servers (client : Client ) -> None :
9991 """Demo: Search MCP servers using various parameters."""
10092 print ("4. 🛠️ Tool: search_mcp_servers" )
101- print (
102- " • Task: 🔍 Search MCP servers (keyword='Chrome', category='browser-automation', limit 3 results)"
103- )
93+ print (" • Task: 🔍 Search MCP servers (keyword='Chrome', category='browser-automation', limit 3 results)" )
10494
10595 result = await client .call_tool (
10696 "search_mcp_servers" ,
@@ -119,9 +109,7 @@ async def demo_search_mcp_servers(client: Client) -> None:
119109 publisher = server .get ("publisher" , "N/A" )
120110 views = server .get ("view_count" , 0 )
121111 server_summary .append (f"{ name } by { publisher } (Views { views :,} )" )
122- print (
123- f" • Result: Found { len (servers )} servers - { ' | ' .join (server_summary )} "
124- )
112+ print (f" • Result: Found { len (servers )} servers - { ' | ' .join (server_summary )} " )
125113 else :
126114 print (" • Result: No MCP servers found" )
127115 print ()
@@ -130,14 +118,12 @@ async def demo_search_mcp_servers(client: Client) -> None:
130118async def demo_generate_image (client : Client ) -> None :
131119 """Demo: Generate image URL from text prompt."""
132120 print ("5. 🛠️ Tool: generate_image" )
133- print (
134- " • Task: 🎨 Generate image (prompt='A curious cat wearing a tiny wizard hat in candy cloud kingdom')"
135- )
121+ print (" • Task: 🎨 Generate image (prompt='A curious cat wearing a tiny wizard hat in candy cloud kingdom')" )
136122
137123 result = await client .call_tool (
138124 "generate_image" ,
139125 {
140- "prompt" : "A curious cat wearing a tiny wizard hat, casting magical rainbow sparkles while riding a flying donut through a candy cloud kingdom" ,
126+ "prompt" : "A curious cat wearing a tiny wizard hat in candy cloud kingdom" ,
141127 },
142128 )
143129
@@ -150,7 +136,7 @@ async def demo_generate_image(client: Client) -> None:
150136
151137
152138def setup_signal_handler ():
153- """Setup signal handler for graceful shutdown."""
139+ """Set up signal handler for graceful shutdown."""
154140
155141 def signal_handler (signum , frame ):
156142 print ("\n 🛑 Demo interrupted by user" )
@@ -160,6 +146,7 @@ def signal_handler(signum, frame):
160146
161147
162148async def main ():
149+ """Run the demo."""
163150 parser = argparse .ArgumentParser (description = "ModelScope MCP server demo" )
164151 parser .add_argument (
165152 "--full" ,
@@ -170,9 +157,7 @@ async def main():
170157
171158 print (f"🤖 ModelScope MCP Server Demo (v{ __version__ } )" )
172159 if not args .full :
173- print (
174- "💡 Running basic demos only. Use --full to include slow demos (like image generation)"
175- )
160+ print ("💡 Running basic demos only. Use --full to include slow demos (like image generation)" )
176161
177162 # Set log level to WARNING to avoid too many logs
178163 settings .log_level = "WARNING"
0 commit comments