Skip to content

[Bug] Tool parameter schema maps long/float (and all other non-int/double numerics) to "object" #1015

Description

@Zhuoxi2000

Search before asking

  • I searched in the issues and found nothing similar.

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

  1. 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) { ... }

  2. Call SchemaUtils.generateSchema(method, null), or inspect the schema sent by any chat model connector.

  3. 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?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug[Issue Type] Something isn't working as expected.priority/majorDefault priority of the PR or issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions