spring-projects / spring-projects/spring-ai

Tool json schema does not work for parameters

Open
#5,633 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
1d 7h
Merged PRs (30d)
6

Description

When we define a tool method, e.g.

    public String getBuilds(
            @ToolParam(description = "test")
            @ArraySchema(maxItems = 50, minItems = 1)
            List<String> buildIds,
            ToolContext toolContext) {

The description is been added to the json schema, however, other annotations supported by the json schema generator are not been honored and the generated schema does not include the maxItems/minItems

Contributor guide

Open the contributing guide

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.

Research direction

Start by reproducing the tool method example with @ToolParam and @ArraySchema, then trace the tool JSON schema generation path for method parameters. Compare the generated schema with the annotations and verify that maxItems and minItems appear alongside the parameter description.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.