generated from micronaut-projects/micronaut-project-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Expected Behavior
When a @ToolArg parameter is a List for example, it should be described as array when listing tools.
Actual Behaviour
The argument is described as object.
Claude works around it but ChatGPT is more strict and tries to wrap its queries in objects.
For example: {"someList": {"someList": ["someItem"]}}
Steps To Reproduce
With those tools
@Singleton
public class TestTools {
@Tool
String withToolArg(@ToolArg List<String> someList) {
return "test";
}
@Tool
String withJsonSchema(JsonSchemaRequest request) {
return "test";
}
}
and this request object
/**
* @param someList List of things
*/
@Introspected
@JsonSchema
public record JsonSchemaRequest(
List<String> someList
) {
}
a call to list tools returns
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tools": [
{
"name": "withToolArg",
"inputSchema": {
"type": "object",
"properties": {
"someList": {
"type": "object"
}
},
"required": [
"someList"
]
}
},
{
"name": "withJsonSchema",
"inputSchema": {
"type": "object",
"properties": {
"someList": {
"description": "List of things",
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
]
}
}
Another difference we can see here is also that arguments are:
- required by default with
@JsonSchema - optional by default with
@ToolArg
Environment Information
No response
Example Application
No response
Version
4.10.3
0.0.17
Metadata
Metadata
Assignees
Labels
No labels