Skip to content

deserialization doesn't work with kotlin and @McpToolParam #4481

@kylelutze

Description

@kylelutze

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions