66 MCP_TOOL_TRIGGER
77)
88from azure .functions .decorators .core import Trigger , DataType
9- from azure .functions .decorators .function_app import FunctionBuilder
109
1110# Mapping Python types to MCP property types
1211_TYPE_MAPPING = {
@@ -34,10 +33,6 @@ def __init__(self,
3433 self .tool_properties = tool_properties
3534 super ().__init__ (name = name , data_type = data_type )
3635
37- # MCP-specific context object
38- class MCPToolContext (Dict [str , Any ]):
39- """Injected context object for MCP tool triggers."""
40- pass
4136
4237# Helper to extract actual type and description from Annotated types
4338def _extract_type_and_description (param_name : str , type_hint : Any ) -> Tuple [Any , str ]:
@@ -48,28 +43,3 @@ def _extract_type_and_description(param_name: str, type_hint: Any) -> Tuple[Any,
4843 param_description = next ((a for a in args [1 :] if isinstance (a , str )), f"The { param_name } parameter." )
4944 return actual_type , param_description
5045 return type_hint , f"The { param_name } parameter."
51-
52- def _get_user_function (target_func ):
53- """
54- Unwraps decorated or builder-wrapped functions to find the original
55- user-defined function (the one starting with 'def' or 'async def').
56- """
57- logging .info ("HELLO FROM THE SDK" )
58- # Case 1: It's a FunctionBuilder object
59- if isinstance (target_func , FunctionBuilder ):
60- # Access the internal user function
61- try :
62- return target_func ._function .get_user_function ()
63- except AttributeError :
64- pass
65-
66- # Case 2: It's already the user-defined function
67- if callable (target_func ) and hasattr (target_func , "__name__" ):
68- return target_func
69-
70- # Case 3: It might be a partially wrapped callable
71- if hasattr (target_func , "__wrapped__" ):
72- return _get_user_function (target_func .__wrapped__ )
73-
74- # Default fallback
75- return target_func
0 commit comments