Search before asking
Description
Description
SchemaUtils.getParamSchema maps Java parameter types to JSON Schema with a small if/else chain. It currently handles String, int/Integer, double/Double, and boolean/Boolean; everything else falls back to "object".
As a result, common numeric types such as long, Long, float, Float, short, and byte are advertised to the model as objects. For example, a tool like getOrder(long orderId) generates "type": "object" for orderId.
This can cause models to produce the wrong argument shape or avoid the tool call entirely, while the failure looks like a model/tool-calling issue rather than a schema-generation bug.
Expected:
long / Long / short / Short / byte / Byte → "integer"
float / Float → "number"
Suggested fix: extend the existing numeric mappings in getParamSchema and add SchemaUtilsTest coverage for these types. Arrays, collections, and POJOs can continue falling back to "object" for now.
How to reproduce
-
Define a tool with a numeric type that is not currently recognized:
@tool(description = "Fetch an order")
public static String getOrder(@ToolParam(name = "orderId") long orderId) { ... }
-
Call SchemaUtils.generateSchema(method, null), or inspect the schema sent by any chat model connector.
-
The generated schema contains:
"orderId": {"type": "object"}
Expected:
"orderId": {"type": "integer"}
Version and environment
Current main (3070ee2). Pure schema-generation issue in plan's SchemaUtils; affects every
chat-model integration that forwards the generated tool schema.
Are you willing to submit a PR?
Search before asking
Description
Description
SchemaUtils.getParamSchemamaps Java parameter types to JSON Schema with a small if/else chain. It currently handlesString,int/Integer,double/Double, andboolean/Boolean; everything else falls back to"object".As a result, common numeric types such as
long,Long,float,Float,short, andbyteare advertised to the model as objects. For example, a tool likegetOrder(long orderId)generates"type": "object"fororderId.This can cause models to produce the wrong argument shape or avoid the tool call entirely, while the failure looks like a model/tool-calling issue rather than a schema-generation bug.
Expected:
long/Long/short/Short/byte/Byte→"integer"float/Float→"number"Suggested fix: extend the existing numeric mappings in
getParamSchemaand addSchemaUtilsTestcoverage for these types. Arrays, collections, and POJOs can continue falling back to"object"for now.How to reproduce
Define a tool with a numeric type that is not currently recognized:
@tool(description = "Fetch an order")
public static String getOrder(@ToolParam(name = "orderId") long orderId) { ... }
Call
SchemaUtils.generateSchema(method, null), or inspect the schema sent by any chat model connector.The generated schema contains:
"orderId": {"type": "object"}
Expected:
Version and environment
Current main (3070ee2). Pure schema-generation issue in
plan's SchemaUtils; affects everychat-model integration that forwards the generated tool schema.
Are you willing to submit a PR?