Skip to content

Add cache_hints constructor map for SEP-2549 caching hints - #3015

Merged
maxisbey merged 2 commits into
mainfrom
cache-hints
Jun 29, 2026
Merged

Add cache_hints constructor map for SEP-2549 caching hints#3015
maxisbey merged 2 commits into
mainfrom
cache-hints

Document the client-side story for caching hints

20a2d64
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jun 29, 2026 in 17m 39s

Code review found 1 potential issue

Found 4 candidates, confirmed 1. See review comments for details.

Details

Severity Count
🔴 Important 0
🟡 Nit 1
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit src/mcp/server/caching.py:56-63 apply_cache_hint docstring misstates model_construct behavior

Annotations

Check warning on line 63 in src/mcp/server/caching.py

See this annotation in the file changed.

@claude claude / Claude Code Review

apply_cache_hint docstring misstates model_construct behavior

The docstring caveat "A handler constructing results with `model_construct` bypasses that tracking and is treated as having set nothing" is factually wrong: pydantic's `model_construct` defaults `__pydantic_fields_set__` to the keys actually passed, so an explicit `ttl_ms`/`cache_scope` passed via `model_construct` still wins over the configured hint, exactly like normal construction. The runtime behavior is correct — only the sentence needs correcting or dropping (it only holds when a handler p