Skip to content

Fix ToolCallback overload selection in ChatClient#6141

Open
juanjuandog wants to merge 1 commit into
spring-projects:mainfrom
juanjuandog:fix/chatclient-toolcallback-overload
Open

Fix ToolCallback overload selection in ChatClient#6141
juanjuandog wants to merge 1 commit into
spring-projects:mainfrom
juanjuandog:fix/chatclient-toolcallback-overload

Conversation

@juanjuandog
Copy link
Copy Markdown
Contributor

A direct ToolCallback argument to tools(...) binds to Object... today. That sends FunctionToolCallback through the @tool method path and ends with "No @tool annotated methods found".

This adds the specific ToolCallback and ToolCallbackProvider overloads for tools(...) and defaultTools(...), routed through the existing ToolSpec callback path.

Closes #2495

Tests:

  • ./mvnw -Dmaven.build.cache.enabled=false -pl spring-ai-client-chat -Dtest=DefaultChatClientTests#whenToolCallbackPassedDirectlyToToolsThenReturn,DefaultChatClientBuilderTests#whenToolCallbackPassedDirectlyToDefaultToolsThenReturn test
  • ./mvnw -Dmaven.build.cache.enabled=false -pl spring-ai-client-chat test

Signed-off-by: juanjuandog <juanjuandog@users.noreply.github.com>
@juanjuandog juanjuandog force-pushed the fix/chatclient-toolcallback-overload branch from 6a11990 to 462f3d5 Compare May 24, 2026 14:15
@juanjuandog
Copy link
Copy Markdown
Contributor Author

This still looks clean from my side. The branch is up to date and the checks are green, so I think this is ready for review when you have a chance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The overload tools or defaultTools method in ChatClientBuilder causes FunctionToolCallback not taking effect.

1 participant