Skip to content

fix: emit cache hints from handler macros - #1120

Open
DaleSeo wants to merge 1 commit into
mainfrom
fix/1114-handler-cache-hints
Open

fix: emit cache hints from handler macros#1120
DaleSeo wants to merge 1 commit into
mainfrom
fix/1114-handler-cache-hints

Conversation

@DaleSeo

@DaleSeo DaleSeo commented Aug 3, 2026

Copy link
Copy Markdown
Member

Fixes #1114

Motivation and Context

Strict clients using protocol version 2026-07-28 reject list responses that don't include ttlMs and cacheScope. As a result, servers using the documented handler macros don't work until the first tool or prompt call. This PR fixes that by adding immediately stale public cache hints for modern clients while continuing to omit them for legacy clients. With this fix macro-generated tools/list and prompts/list responses include the cache hints required by clients that negotiate protocol version 2026-07-28. Older clients still receive the same legacy wire format.

How Has This Been Tested?

Added integration tests

Breaking Changes

None. The new fields are emitted only where the negotiated protocol requires them.

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

@github-actions github-actions Bot added T-test Testing related changes T-macros Macro changes labels Aug 3, 2026
@DaleSeo
DaleSeo marked this pull request as ready for review August 3, 2026 19:31
@DaleSeo
DaleSeo requested a review from a team as a code owner August 3, 2026 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-macros Macro changes T-test Testing related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

#[tool_handler] and #[prompt_handler] emit ttl_ms: None / cache_scope: None, which a 2026-07-28 client rejects

1 participant