Skip to content

Commit 1c67e3f

Browse files
wenjin272claude
andcommitted
[api] Document parameter_types format in ToolSpec
Per PR #670 review comment by xintongsong: spell out exactly what strings are accepted in a Java tool's ``parameter_types`` list — order, primitive aliases, fully-qualified reference types (boxed primitives included), and the no-generics rule (JVM method descriptors don't carry type parameters). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 1b11645 commit 1c67e3f

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

docs/yaml-schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@
302302
},
303303
"ToolSpec": {
304304
"additionalProperties": false,
305-
"description": "Points ``function:`` at a callable tool.\n\n``function`` is written as ``<module-or-class>:<qualname>`` \u2014 the\ncolon separates the Python module (or Java class FQN) from the\nattribute path inside it. For Python, the right side may be a\nnested ``Class.method``.\n\n``parameter_types`` is required when ``type: java`` (Java method\nsignatures vary across tools).",
305+
"description": "Points ``function:`` at a callable tool.\n\n``function`` is written as ``<module-or-class>:<qualname>`` \u2014 the\ncolon separates the Python module (or Java class FQN) from the\nattribute path inside it. For Python, the right side may be a\nnested ``Class.method``.\n\n``parameter_types`` is required when ``type: java`` and is ignored\notherwise (Python tools are reflected from the callable signature).\nThe list contains one string per declared parameter of the Java\nmethod, in declaration order \u2014 the loader uses it to disambiguate\noverloaded methods on the Java class. Each string is one of:\n\n- A Java primitive name: one of ``boolean``, ``byte``, ``short``,\n ``int``, ``long``, ``float``, ``double``, ``char``.\n- A fully-qualified Java reference type (including boxed\n primitives), e.g. ``java.lang.Double``, ``java.lang.String``,\n ``java.util.List``.\n\nGeneric type arguments are not part of the JVM method descriptor\nand must not be included (``java.util.List``, not\n``java.util.List<String>``).",
306306
"properties": {
307307
"function": {
308308
"anyOf": [

python/flink_agents/api/yaml/specs.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,21 @@ class ToolSpec(BaseModel):
9898
attribute path inside it. For Python, the right side may be a
9999
nested ``Class.method``.
100100
101-
``parameter_types`` is required when ``type: java`` (Java method
102-
signatures vary across tools).
101+
``parameter_types`` is required when ``type: java`` and is ignored
102+
otherwise (Python tools are reflected from the callable signature).
103+
The list contains one string per declared parameter of the Java
104+
method, in declaration order — the loader uses it to disambiguate
105+
overloaded methods on the Java class. Each string is one of:
106+
107+
- A Java primitive name: one of ``boolean``, ``byte``, ``short``,
108+
``int``, ``long``, ``float``, ``double``, ``char``.
109+
- A fully-qualified Java reference type (including boxed
110+
primitives), e.g. ``java.lang.Double``, ``java.lang.String``,
111+
``java.util.List``.
112+
113+
Generic type arguments are not part of the JVM method descriptor
114+
and must not be included (``java.util.List``, not
115+
``java.util.List<String>``).
103116
"""
104117

105118
model_config = ConfigDict(extra="forbid")

0 commit comments

Comments
 (0)