5353
5454# ===== TOOLS =====
5555
56+ # --- Simple Content Tools ---
57+ # Tools that return a single content type (text, image, audio)
58+
5659
5760@mcp .tool ()
5861def test_simple_text () -> str :
@@ -72,6 +75,10 @@ def test_audio_content() -> list[AudioContent]:
7275 return [AudioContent (type = "audio" , data = TEST_AUDIO_BASE64 , mimeType = "audio/wav" )]
7376
7477
78+ # --- Complex Content Tools ---
79+ # Tools with embedded resources or multiple content types
80+
81+
7582@mcp .tool ()
7683def test_embedded_resource () -> list [EmbeddedResource ]:
7784 """Tests embedded resource content response"""
@@ -104,6 +111,10 @@ def test_multiple_content_types() -> list[TextContent | ImageContent | EmbeddedR
104111 ]
105112
106113
114+ # --- Async Tools ---
115+ # Tools that demonstrate async operations, logging, progress, sampling, and elicitation
116+
117+
107118@mcp .tool ()
108119async def test_tool_with_logging (ctx : Context [ServerSession , None ]) -> str :
109120 """Tests tool that emits log messages during execution"""
@@ -133,12 +144,6 @@ async def test_tool_with_progress(ctx: Context[ServerSession, None]) -> str:
133144 return str (progress_token )
134145
135146
136- @mcp .tool ()
137- def test_error_handling () -> str :
138- """Tests error response handling"""
139- raise RuntimeError ("This tool intentionally returns an error for testing" )
140-
141-
142147class SamplingInput (BaseModel ):
143148 prompt : str = Field (description = "The prompt to send to the LLM" )
144149
@@ -189,8 +194,20 @@ async def test_elicitation(message: str, ctx: Context[ServerSession, None]) -> s
189194 return f"Elicitation not supported or error: { str (e )} "
190195
191196
197+ # --- Error Handling Tools ---
198+ # Tools that test error handling behavior
199+
200+
201+ @mcp .tool ()
202+ def test_error_handling () -> str :
203+ """Tests error response handling"""
204+ raise RuntimeError ("This tool intentionally returns an error for testing" )
205+
206+
192207# ===== RESOURCES =====
193208
209+ # Static and dynamic resources demonstrating text, binary, templates, and subscriptions
210+
194211
195212@mcp .resource ("test://static-text" )
196213def static_text_resource () -> str :
@@ -222,6 +239,8 @@ def watched_resource() -> str:
222239
223240# ===== PROMPTS =====
224241
242+ # Prompts demonstrating simple text, arguments, embedded resources, and images
243+
225244
226245@mcp .prompt ()
227246def test_simple_prompt () -> list [UserMessage ]:
@@ -269,6 +288,8 @@ def test_prompt_with_image() -> list[UserMessage]:
269288
270289# ===== CUSTOM REQUEST HANDLERS =====
271290
291+ # Handlers for logging level control, resource subscriptions, and completion
292+
272293
273294def setup_custom_handlers ():
274295 """Set up custom request handlers for logging and completion."""
0 commit comments