99_SNIPPET_PROPERTY_NAME = "snippet"
1010_BLOB_PATH = "snippets/{mcptoolargs." + _SNIPPET_NAME_PROPERTY_NAME + "}.json"
1111
12+ class ToolProperty :
13+ def __init__ (self , property_name : str , property_type : str , description : str ):
14+ self .propertyName = property_name
15+ self .propertyType = property_type
16+ self .description = description
17+
18+ def to_dict (self ):
19+ return {
20+ "propertyName" : self .propertyName ,
21+ "propertyType" : self .propertyType ,
22+ "description" : self .description
23+ }
24+
25+ # Define the tool properties using the ToolProperty class
26+ tool_properties_save_snippets_object = [
27+ ToolProperty (_SNIPPET_NAME_PROPERTY_NAME , "string" , "The name of the snippet." ),
28+ ToolProperty (_SNIPPET_PROPERTY_NAME , "string" , "The content of the snippet." )
29+ ]
30+
31+ tool_properties_get_snippets_object = [
32+ ToolProperty (_SNIPPET_NAME_PROPERTY_NAME , "string" , "The name of the snippet." )
33+ ]
34+
35+ # Convert the tool properties to JSON
36+ tool_properties_save_snippets_json = json .dumps ([prop .to_dict () for prop in tool_properties_save_snippets_object ])
37+ tool_properties_get_snippets_json = json .dumps ([prop .to_dict () for prop in tool_properties_get_snippets_object ])
38+
39+
1240@app .generic_trigger (arg_name = "context" , type = "mcpToolTrigger" , toolName = "hello" ,
1341 description = "Hello world." ,
1442 toolProperties = "[]" )
@@ -30,7 +58,7 @@ def hello_mcp(context) -> None:
3058 type = "mcpToolTrigger" ,
3159 toolName = "getsnippet" ,
3260 description = "Retrieve a snippet by name." ,
33- toolProperties = f"[{{ \" propertyName \" : \" { _SNIPPET_NAME_PROPERTY_NAME } \" , \" propertyType \" : \" string \" , \" description \" : \" The name of the snippet. \" }}]"
61+ toolProperties = tool_properties_get_snippets_json
3462)
3563@app .generic_input_binding (
3664 arg_name = "file" ,
@@ -59,9 +87,8 @@ def get_snippet(file: func.InputStream, context) -> str:
5987 type = "mcpToolTrigger" ,
6088 toolName = "savesnippet" ,
6189 description = "Save a snippet with a name." ,
62- toolProperties = f"[{{\" propertyName\" :\" { _SNIPPET_NAME_PROPERTY_NAME } \" ,\" propertyType\" :\" string\" ,\" description\" :\" The name of the snippet.\" }},"
63- f"{{\" propertyName\" :\" { _SNIPPET_PROPERTY_NAME } \" ,\" propertyType\" :\" string\" ,\" description\" :\" The content of the snippet.\" }}]"
64- )
90+ toolProperties = tool_properties_save_snippets_json
91+ )
6592@app .generic_output_binding (
6693 arg_name = "file" ,
6794 type = "blob" ,
0 commit comments