Skip to content

feat(types): add SEP-2549 cache hints to result models#2824

Open
MicroYui wants to merge 1 commit into
modelcontextprotocol:mainfrom
MicroYui:feat/sep-2549-cacheable-results
Open

feat(types): add SEP-2549 cache hints to result models#2824
MicroYui wants to merge 1 commit into
modelcontextprotocol:mainfrom
MicroYui:feat/sep-2549-cacheable-results

Conversation

@MicroYui

@MicroYui MicroYui commented Jun 9, 2026

Copy link
Copy Markdown

Summary

Implements SEP-2549 cache hints for Python SDK protocol result models.

Adds ttlMs and cacheScope support to:

  • ListToolsResult
  • ListPromptsResult
  • ListResourcesResult
  • ListResourceTemplatesResult
  • ReadResourceResult

The SDK defaults to ttlMs=0 and cacheScope="public" so existing Python code constructing these models remains usable while serialized responses include the new cache hint fields. Older server responses that omit the fields also parse with those defaults.

This PR does not implement client-side caching, cache invalidation logic, or new high-level MCPServer cache configuration APIs.

Fixes #2802.

Tests

  • uv run --frozen pytest tests/test_types.py -q
  • uv run --frozen pytest tests/server/lowlevel/test_server_listing.py tests/interaction/lowlevel/test_wire.py tests/server/mcpserver/test_server.py -q
  • uv run --frozen pytest tests/interaction/test_coverage.py tests/interaction/lowlevel/test_wire.py -q
  • uv run --frozen ruff format --check .
  • uv run --frozen ruff check .
  • uv run --frozen pyright --pythonplatform Linux

Add cache hint fields to list and resource-read protocol result models with conservative defaults of ttlMs=0 and cacheScope=public.

Cover default serialization, explicit hints, validation, low-level wire behavior, high-level MCPServer defaults, and migration notes without adding new high-level server configuration API.
@MicroYui MicroYui force-pushed the feat/sep-2549-cacheable-results branch from 8c3934f to c8cc2eb Compare June 9, 2026 16:21
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

1 participant