@@ -3627,6 +3627,75 @@ def test_flow_tool_resource_case_insensitive(self):
36273627 assert isinstance (tool_resource , AgentProcessToolResourceConfig )
36283628 assert tool_resource .type == AgentToolType .FLOW
36293629
3630+ def test_function_tool_type_enum_value (self ):
3631+ """AgentToolType.FUNCTION exists with the wire value 'Function' and is case-insensitive."""
3632+ assert AgentToolType .FUNCTION .value == "Function"
3633+ assert AgentToolType ("function" ) is AgentToolType .FUNCTION
3634+ assert AgentToolType ("FUNCTION" ) is AgentToolType .FUNCTION
3635+
3636+ def test_function_tool_resource_deserialization (self ):
3637+ """A resource with type='Function' is parsed as AgentProcessToolResourceConfig."""
3638+ resources = [
3639+ {
3640+ "$resourceType" : "tool" ,
3641+ "type" : "Function" ,
3642+ "id" : "function-tool-1" ,
3643+ "inputSchema" : {
3644+ "type" : "object" ,
3645+ "properties" : {"input" : {"type" : "string" }},
3646+ },
3647+ "outputSchema" : {"type" : "object" , "properties" : {}},
3648+ "arguments" : {},
3649+ "settings" : {"timeout" : 0 , "maxAttempts" : 0 , "retryDelay" : 0 },
3650+ "properties" : {
3651+ "processName" : "MyFunction" ,
3652+ "folderPath" : "/Shared/Functions" ,
3653+ },
3654+ "name" : "Function Tool" ,
3655+ "description" : "Test Function tool" ,
3656+ }
3657+ ]
3658+
3659+ json_data = self ._agent_dict_with_resources (resources )
3660+ config : AgentDefinition = TypeAdapter (AgentDefinition ).validate_python (
3661+ json_data
3662+ )
3663+
3664+ tool_resource = config .resources [0 ]
3665+ assert isinstance (tool_resource , AgentProcessToolResourceConfig )
3666+ assert tool_resource .type == AgentToolType .FUNCTION
3667+ assert tool_resource .properties .process_name == "MyFunction"
3668+ assert tool_resource .properties .folder_path == "/Shared/Functions"
3669+
3670+ def test_function_tool_resource_case_insensitive (self ):
3671+ """A resource with lowercase type='function' also deserializes via CaseInsensitiveEnum."""
3672+ resources = [
3673+ {
3674+ "$resourceType" : "tool" ,
3675+ "type" : "function" ,
3676+ "id" : "function-tool-2" ,
3677+ "inputSchema" : {"type" : "object" , "properties" : {}},
3678+ "outputSchema" : {"type" : "object" , "properties" : {}},
3679+ "arguments" : {},
3680+ "settings" : {"timeout" : 0 , "maxAttempts" : 0 , "retryDelay" : 0 },
3681+ "properties" : {
3682+ "processName" : "MyFunction" ,
3683+ "folderPath" : "/Shared/Functions" ,
3684+ },
3685+ "name" : "Function Tool" ,
3686+ "description" : "Test Function tool" ,
3687+ }
3688+ ]
3689+
3690+ json_data = self ._agent_dict_with_resources (resources )
3691+ config : AgentDefinition = TypeAdapter (AgentDefinition ).validate_python (
3692+ json_data
3693+ )
3694+
3695+ tool_resource = config .resources [0 ]
3696+ assert isinstance (tool_resource , AgentProcessToolResourceConfig )
3697+ assert tool_resource .type == AgentToolType .FUNCTION
3698+
36303699 def test_escalation_missing_escalation_type_defaults_to_zero (self ):
36313700 """Test that missing escalationType defaults to 0."""
36323701 resources = [
0 commit comments