We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5864255 commit a2a6dc3Copy full SHA for a2a6dc3
spring-ai-model/src/main/java/org/springframework/ai/tool/method/MethodToolCallback.java
@@ -119,7 +119,7 @@ private void validateToolContextSupport(@Nullable ToolContext toolContext) {
119
var isNonEmptyToolContextProvided = toolContext != null && !CollectionUtils.isEmpty(toolContext.getContext());
120
var isToolContextAcceptedByMethod = Stream.of(toolMethod.getParameterTypes())
121
.anyMatch(type -> ClassUtils.isAssignable(type, ToolContext.class));
122
- if (isToolContextAcceptedByMethod && !isNonEmptyToolContextProvided) {
+ if (isNonEmptyToolContextProvided && !isToolContextAcceptedByMethod) {
123
throw new IllegalArgumentException("ToolContext is required by the method as an argument");
124
}
125
0 commit comments