fix: improve warning message when MCP tool is skipped in stateless mode#5787
Open
anuragg-saxenaa wants to merge 3 commits intospring-projects:mainfrom
Open
Conversation
…ing-projects#1818) Add @ConditionalOnProperty to the openAiApi bean inside OpenAiChatAutoConfiguration so it is only created when either spring.ai.openai.api-key or spring.ai.openai.chat.api-key is present. Previously, configuring only spring.ai.openai.image.api-key caused an IllegalArgumentException at startup because the chat auto-configuration always tried to resolve a chat API key. Adds a regression test that loads both chat and image auto-configurations with only the image API key set, and verifies the context starts successfully with the image model present and no chat model created. Signed-off-by: anuragg-saxenaa <anuragg.saxenaa@gmail.com>
Integer.parseInt() throws NumberFormatException for values exceeding Integer.MAX_VALUE (2147483647). visitIntegerConstant now falls back to Long.parseLong() for out-of-range values, allowing filter expressions like `id == 9223372036854775807` to parse correctly without requiring an explicit 'L' suffix. Fixes: spring-projectsgh-4705 Signed-off-by: anuragg-saxenaa <anuragg.saxenaa@gmail.com>
…s in stateless mode The previous warning log in filterMethodWithBidirectionalParameters() used method.toString() which produces a verbose, hard-to-read signature. Developers had no actionable context about which tool class and method was silently dropped or why. The updated warning includes: - Declaring class simple name and method name (e.g. 'MyTools.doWork') - The specific bidirectional parameter types that caused the skip (e.g. McpSyncServerExchange) - A suggestion to switch to a stateful server if bidirectional parameters are required Fixes: spring-projectsgh-5373 Signed-off-by: anuragg-saxenaa <anuragg.saxenaa@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #5373.
When a
@McpToolmethod hasMcpSyncServerExchangeorMcpSyncRequestContextparameters,SyncStatelessMcpToolProvidersilently drops the tool during discovery. The previous warning was:This is hard to parse —
method.toString()produces a long reflection signature with no actionable guidance.New warning:
Changes:
ClassName.methodNameinstead of the rawMethod.toString()reflection dumpNo behavior change — tools are still filtered the same way. Only the log message is improved.
Testing
All 46 existing
McpPredicatesTestspass unchanged — the filter behavior is identical.