Skip to content

feat(core): add SEP-2549 cache hints to list and read results - #1185

Open
devcrocod wants to merge 1 commit into
mainfrom
devcrocod/sep-2549-cache-hints
Open

devcrocod wants to merge 1 commit into
mainfrom
devcrocod/sep-2549-cache-hints

Conversation

@devcrocod

Copy link
Copy Markdown
Contributor

Closes #813

Breaking Changes

None

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Copilot AI balanced review requested due to automatic review settings November 16, 2026 12:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 ttlMs and cacheScope to five result types, with non-negative TTL validation and defaults for older responses.
  • Makes CacheScope non-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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement SEP-2549: TTL for List Results

2 participants