This is an automated email from the ASF dual-hosted git repository.

wenjin272 pushed a commit to branch release-0.3
in repository https://gitbox.apache.org/repos/asf/flink-agents.git


The following commit(s) were added to refs/heads/release-0.3 by this push:
     new f38ed48b [python] Tolerate Java tool params without a description 
(#915)
f38ed48b is described below

commit f38ed48bb93ff048588a5f4d47887fba8d4d4fae
Author: Edson <[email protected]>
AuthorDate: Sat Jul 18 04:45:05 2026 -0400

    [python] Tolerate Java tool params without a description (#915)
    
    (cherry picked from commit be9716fc24235bbe0d88e10fda87650b2a189f57)
---
 python/flink_agents/api/tools/tests/test_utils.py | 10 ++++++++++
 python/flink_agents/api/tools/utils.py            |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/python/flink_agents/api/tools/tests/test_utils.py 
b/python/flink_agents/api/tools/tests/test_utils.py
index b1d01f09..a98ef921 100644
--- a/python/flink_agents/api/tools/tests/test_utils.py
+++ b/python/flink_agents/api/tools/tests/test_utils.py
@@ -174,6 +174,16 @@ def test_model_from_java_schema_fields_are_required() -> 
None:
     assert field.is_required()
 
 
+def test_model_from_java_schema_without_description() -> None:
+    # Java only emits a "description" key for a @ToolParam with a non-empty
+    # description (ToolParam.description() defaults to ""), so a param without
+    # one must be tolerated and fall back to a generated description.
+    schema_str = json.dumps({"properties": {"a": {"type": "number"}}})
+    field = create_model_from_java_tool_schema_str("J", 
schema_str).model_fields["a"]
+    assert field.annotation is float
+    assert field.description == "Parameter: a"
+
+
 # ---- create_java_tool_schema_str_from_model 
----------------------------------
 
 
diff --git a/python/flink_agents/api/tools/utils.py 
b/python/flink_agents/api/tools/utils.py
index f1145b5c..79a15707 100644
--- a/python/flink_agents/api/tools/utils.py
+++ b/python/flink_agents/api/tools/utils.py
@@ -188,7 +188,7 @@ def create_model_from_java_tool_schema_str(
 
     fields = {}
     for param_name in properties:
-        description = properties[param_name]["description"]
+        description = properties[param_name].get("description")
         if description is None:
             description = f"Parameter: {param_name}"
         type = TYPE_MAPPING.get(properties[param_name]["type"])

Reply via email to