Title: Freeform stopReasons in sampling responses are unsupported · Issue #328 · modelcontextprotocol/java-sdk · GitHub
Open Graph Title: Freeform stopReasons in sampling responses are unsupported · Issue #328 · modelcontextprotocol/java-sdk
X Title: Freeform stopReasons in sampling responses are unsupported · Issue #328 · modelcontextprotocol/java-sdk
Description: 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.InvalidFormatExcep...
Open Graph Description: 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...
X Description: 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...
Opengraph URL: https://github.com/modelcontextprotocol/java-sdk/issues/328
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Freeform stopReasons in sampling responses are unsupported","articleBody":"**Bug description**\nThe spec defines some well-known `stopReason` values, but also allows arbitrary values to be passed as well ([spec](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/f5ccad944fdf2b7d9cc70cf817f66ca5a8aa03a4/schema/2024-11-05/schema.ts#L807)). When parsing these, the Java SDK throws an exception:\n\n```\ncom.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]\n```\n\n**Environment**\nJDK21\n\n**Steps to reproduce**\nSee PR #327\n\n**Expected behavior**\nSDK does not throw\n\n**Minimal Complete Reproducible example**\nSee PR #327\n","author":{"url":"https://github.com/LucaButBoring","@type":"Person","name":"LucaButBoring"},"datePublished":"2025-06-19T21:09:53.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/328/java-sdk/issues/328"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4c0faaae-6c3e-c87c-6965-6d184e9769c0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E8FE:212243:2FA292:3E9593:6A5B1F3F |
| html-safe-nonce | 4325f658625ac0608eca8607428a4d8391f86b11c88708ebed8869dc559d2456 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOEZFOjIxMjI0MzoyRkEyOTI6M0U5NTkzOjZBNUIxRjNGIiwidmlzaXRvcl9pZCI6IjE2MDgxOTU3OTY0NzgxNDAyMjMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 56c27c1a2cc28437df9911366e7016c423f7ec8a846855bc01b51e71a0008729 |
| hovercard-subject-tag | issue:3161337516 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/modelcontextprotocol/java-sdk/328/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3f364a9a424fe83d18c7962f7208c2a4230605c1eb8f4d3f986f11daf3ee85ba/modelcontextprotocol/java-sdk/issues/328 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3f364a9a424fe83d18c7962f7208c2a4230605c1eb8f4d3f986f11daf3ee85ba/modelcontextprotocol/java-sdk/issues/328 |
| og:image:alt | 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... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | LucaButBoring |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| go-import | github.com/modelcontextprotocol/java-sdk git https://github.com/modelcontextprotocol/java-sdk.git |
| octolytics-dimension-user_id | 182288589 |
| octolytics-dimension-user_login | modelcontextprotocol |
| octolytics-dimension-repository_id | 919609219 |
| octolytics-dimension-repository_nwo | modelcontextprotocol/java-sdk |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 919609219 |
| octolytics-dimension-repository_network_root_nwo | modelcontextprotocol/java-sdk |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width