spring-projects / spring-projects/spring-ai
deserialization doesn't work with kotlin and @McpToolParam
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.5k
- Forks
- 2.9k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 5
Description
Bug description
When using @Tool+@ToolParam with a bean that returns ToolCallbackProvider for the class, if the ToolParam is an object, such as
@Serialization
data class UserSearchRequest(
userId: UUID? = null,
username: String? = null,
)
It will be deserialized as expected. When using @McpTool+@McpToolParam, I instead get the error
"Cannot construct instance of `net.package.UserSearchRequest` (no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 2]"
Environment
spring-ai-starter-mcp-server-webmvc:1.1.0-M2
spring-boot 3.5.4
running in stateless mode side by side with a spring webmvc service.
Expected behavior
The data object to be deserialized successfully.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure with the shown UserSearchRequest and @McpTool/@McpToolParam setup, then compare it with the working @Tool/@ToolParam path. Inspect the Spring MVC MCP server deserialization entry point and verify that the Kotlin data object is deserialized successfully without the no-Creators error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin, spring, spring-boot
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100