Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[spring-ai] ToolConverter silently drops enum and items from tool parameter schemas

Open Beginner friendly
#1,609 2 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@hirematha is already working on this.

Since Oct 5, 2026.

  • #1617 by @caps-xia — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
java, spring
Domain
ai

Research direction

The drop happens in ToolConverter#convertSchemaToSpringAi, reached from convertToSpringAiTools when each ToolDefinition input schema is built; start by reading that method and the genai Schema and Spring AI schema types it maps between. Reproduce with the issue's minimal example (an enum string property plus an array property with items), then map enum_ and items per property, recursing into nested properties. Done means the emitted inputSchema JSON contains enum and items for those parameters while the existing ToolConverter tests still pass.

Written by the indexing model from the issue text.

Description

needs review
Describe the Bug

ToolConverter#convertSchemaToSpringAi (used by convertToSpringAiTools) maps only
type, properties, description and required when converting a genai Schema
to a Spring AI ToolDefinition input schema. enum and items are silently
dropped.

Impact: any ADK tool whose parameters use enum-constrained strings or typed arrays —
including the mainstream path of annotated FunctionTool methods (enum Java fields,
List<String> parameters) — ends up with a degraded schema sent to the model:
enum parameters become free-form strings (models then send invalid values), and array
parameters lose their element type.

Steps to Reproduce
  1. Define a BaseTool whose declaration() returns a FunctionDeclaration with
    parameters containing an enum property and an array-with-items property.
  2. Convert it via new ToolConverter().convertToSpringAiTools(...).
  3. Inspect getToolDefinition().inputSchema() — no enum, no items.
Expected Behavior

enum, items (and ideally format, nullable, minItems/maxItems) survive the
conversion, so the model receives the same parameter constraints the ADK tool declared.

Observed Behavior

Identical output on 1.9.0 and 1.11.0 (latest):

declared: color = string + enum ["red","green"],  tags = array of string (items)
converted inputSchema:
{"description":"参数","type":"object","properties":{"color":{"description":"颜色","type":"string"},"tags":{"description":"标签","type":"array"}},"required":["color"]}
                                   ^ no "enum"                      ^ no "items"
Environment Details
  • ADK Library Version: verified on 1.9.0 and 1.11.0 with identical output;
    on current main, convertSchemaToSpringAi still only emits type/properties
  • OS: macOS (logic bug, OS-independent)
  • TS Version: N/A (Java)
Model Information

Model-independent — the loss happens in tool-definition conversion before any model
call. Observed with GLM via an OpenAI-compatible gateway.

Regression

N/A.

Additional Context

We maintain a patched bridge for this reason (among others): we bypass the wrapped
conversion and restore the original callbacks per tool name so the raw schema reaches
the model. A minimal fix is to map enum_ and items in convertSchemaToSpringAi;
serializing the genai Schema to JSON directly would also work and would future-proof
against further field drift.

Minimal Reproduction Code
Schema color = Schema.builder().type("string")
        .description("颜色").enum_(List.of("red", "green")).build();
Schema tags = Schema.builder().type("array")
        .description("标签").items(Schema.builder().type("string").build()).build();
Schema params = Schema.builder().type("object")
        .properties(Map.of("color", color, "tags", tags))
        .required(List.of("color"))
        .build();

BaseTool tool = new BaseTool("probeTool", "probe") {
    @Override public Optional<FunctionDeclaration> declaration() {
        return Optional.of(FunctionDeclaration.builder()
                .name("probeTool").description("probe").parameters(params).build());
    }
    @Override public Single<Map<String, Object>> runAsync(Map<String, Object> args, ToolContext ctx) {
        return Single.just(Map.of());
    }
};

String schema = new ToolConverter()
        .convertToSpringAiTools(Map.of("probeTool", tool))
        .get(0).getToolDefinition().inputSchema();
// schema contains no "enum" and no "items"
How often has this issue occurred?

Always (100%) — every enum/array tool parameter.

Dominant language
Java
Stars
1.7k
Forks
431
Avg merge
3d 2h
Merged PRs (30d)
46

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from google/adk-java

All issues in google/adk-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.