Skip to content

Conversation

@tzolov
Copy link
Contributor

@tzolov tzolov commented Mar 14, 2025

This change ensures that @tool annotated methods can be properly discovered even when the tool objects are wrapped in Spring AOP proxies, which is common when using aspects or other proxy-based features.

  • Enhance MethodToolCallbackProvider to properly handle AOP proxied tool objects by detecting proxies and retrieving their target classes when scanning for @tool annotated methods.
  • Add test suite in MethodToolCallbackProviderAopTests.java to verify AOP proxy handling

Resolves #2356

This change ensures that @tool annotated methods can be properly discovered even when the tool objects are wrapped
in Spring AOP proxies, which is common when using aspects or other proxy-based features.

- Enhance MethodToolCallbackProvider to properly handle AOP proxied tool objects by detecting proxies
  and retrieving their target classes when scanning for @tool annotated methods.
- Add test suite in MethodToolCallbackProviderAopTests.java to verify AOP proxy handling

Resolves spring-projects#2356

Signed-off-by: Christian Tzolov <[email protected]>
@tzolov tzolov added this to the 1.0.0-M7 milestone Mar 14, 2025
@tzolov tzolov added the bug Something isn't working label Mar 14, 2025
@ilayaperumalg ilayaperumalg merged commit 690d242 into spring-projects:main Mar 14, 2025
2 checks passed
@ilayaperumalg ilayaperumalg self-assigned this Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working tool/function calling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to use @Tool with @PreAuthorize

2 participants