Repository navigation
Conversation
…s and update corresponding tests
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The changes break source and binary compatibility and mishandle cache hints by rejecting negative TTLs during decoding and omitting required default-valued hints during encoding.
3 open issues
What changed in this PR
Adds SEP-2549 cache hints to the Kotlin SDK’s core list and resource-read result models, supporting the MCP 2026-07-28 work tracked in #813.
Changes:
- Adds
ttlMsandcacheScopeto five result types, with non-negative TTL validation and defaults for older responses. - Makes
CacheScopenon-experimental and documents the new properties. - Updates serialization expectations, adds cache-hint tests, and refreshes public API snapshots.
| File | Description |
|---|---|
kotlin-sdk-core/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/types/ToolsTest.kt |
Updates tool-list JSON expectations. |
kotlin-sdk-core/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/types/ResourcesTest.kt |
Updates resource list, template, and read JSON expectations. |
kotlin-sdk-core/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/types/PromptsTest.kt |
Updates prompt-list JSON expectations. |
kotlin-sdk-core/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/types/CacheHintsTest.kt |
Tests negative TTL rejection and missing-hint defaults. |
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/tools.kt |
Adds documented cache hints to tool-list results. |
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/resources.kt |
Adds cache hints to resource list, template, and read results. |
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/prompts.kt |
Adds documented cache hints to prompt-list results. |
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/discovery.kt |
Generalizes CacheScope documentation and removes its experimental annotation. |
kotlin-sdk-core/api/kotlin-sdk-core.klib.api |
Updates multiplatform API signatures. |
kotlin-sdk-core/api/kotlin-sdk-core.api |
Updates JVM API signatures. |
Review effort: Balanced
Comment on lines
+308
to
+309
| val ttlMs: Long = 0, | ||
| val cacheScope: CacheScope = CacheScope.Private, |
Comment on lines
+308
to
+309
| val ttlMs: Long = 0, | ||
| val cacheScope: CacheScope = CacheScope.Private, |
| PaginatedResult | ||
| PaginatedResult { | ||
| init { | ||
| require(ttlMs >= 0) { "ttlMs must be non-negative, but was $ttlMs" } |
This branch has not been deployed
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.

Closes #813
Breaking Changes
None
Types of changes
Checklist