Stamp a real freshness hint on cacheable results - #523
Merged
Conversation
Tool and resource lists, wiki resource reads, and discovery answers only change when a reconcile pass runs, and subscribed clients learn of that through listChanged events. Give them a 60-second ttlMs instead of the default 0 so polling clients can cache between calls, with private scope because the lists reflect this deployment's wiki configuration. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
alistair3149
force-pushed
the
cacheable-result-hints
branch
from
July 30, 2026 18:51
57a59e2 to
d465ce8
Compare
A resources/read result now asserts the per-operation hint — the one operation where a per-registration hint would take precedence, so a future registerResource cacheHint cannot silently shadow it. The legacy-era test asserts hints stay off 2025-era responses. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Sets the SDK's
cacheHintsoption so cacheable 2026-07-28 results (tools/list,resources/list,resources/templates/list,resources/read,server/discover) carryttlMs: 60000, cacheScope: 'private'instead of the defaultttlMs: 0. Everything cacheable changes only on a reconcile pass, and subscribed clients hear about that through listChanged events — the TTL only bounds staleness for clients that poll, and a stale entry is benign: the call it leads to still validates server-side. Private scope because the lists reflect the deployment's wiki configuration. Responses to pre-2026 clients are unaffected, and a test pins that.To decide: the 60-second TTL. Longer would be defensible for mostly-static deployments; shorter mostly defeats the point.
Verified: an end-to-end test drives a real 2026-07-28 client against the era-routing handler and asserts the hint on tools/list, resources/list, and a resources/read result (written first, confirmed failing against the
ttlMs: 0default); full suite green. Smoke-tested over a real HTTP server from the built dist: a client pinned to 2026-07-28 seesttlMs: 60000/cacheScope: "private"on both list results.🤖 Generated with Claude Code