diff --git a/src/google/adk/tools/function_parameter_parse_util.py b/src/google/adk/tools/function_parameter_parse_util.py index d1a1794..5cda5ba 100644 --- a/src/google/adk/tools/function_parameter_parse_util.py +++ b/src/google/adk/tools/function_parameter_parse_util.py @@ -289,6 +289,13 @@ def _parse_schema_from_parameter( ) _raise_if_schema_unsupported(variant, schema) return schema + if param.annotation is None: + # https://swagger.io/docs/specification/v3_0/data-models/data-types/#null + # null is not a valid type in schema, use object instead. + schema.type = types.Type.OBJECT + schema.nullable = True + _raise_if_schema_unsupported(variant, schema) + return schema raise ValueError( f'Failed to parse the parameter {param} of function {func_name} for' ' automatic function calling. Automatic function calling works best with'