Skip to content

Freeform stopReasons in sampling responses are unsupported #328

Open
@LucaButBoring

Description

@LucaButBoring

Bug description
The spec defines some well-known stopReason values, but also allows arbitrary values to be passed as well (spec). When parsing these, the Java SDK throws an exception:

com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type `io.modelcontextprotocol.spec.McpSchema$CreateMessageResult$StopReason` from String "arbitrary value": not one of the values accepted for Enum class: [endTurn, stopSequence, maxTokens]

Environment
JDK21

Steps to reproduce
See PR #327

Expected behavior
SDK does not throw

Minimal Complete Reproducible example
See PR #327

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions