File tree Expand file tree Collapse file tree
src/mcp/server/mcpserver/utilities Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -428,18 +428,15 @@ def _try_create_model_and_schema(
428428
429429def _contains_content_helper_type (annotation : Any ) -> bool :
430430 """Return whether an annotation contains an MCPServer content helper type."""
431- if inspect .isclass (annotation ):
432- try :
433- if issubclass (annotation , Image | Audio ):
434- return True
435- except TypeError :
436- pass
431+ origin = get_origin (annotation )
432+ if origin is None and inspect .isclass (annotation ) and issubclass (annotation , Image | Audio ):
433+ return True
437434
438435 args = get_args (annotation )
439436 if not args :
440437 return False
441438
442- if get_origin ( annotation ) is Annotated :
439+ if origin is Annotated :
443440 return _contains_content_helper_type (args [0 ])
444441
445442 return any (_contains_content_helper_type (arg ) for arg in args )
You can’t perform that action at this time.
0 commit comments