Define handling for protocol-incompatible result properties set by applications
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Da chiarire
- Stato di attività
- Tranquilla
- Stack tecnologico
- csharp
- Ambito
- api, backend-api-design
Direzione di ricerca
Inizia dal confine condiviso post-handler e leggi come McpServerImpl.IsJuly2026OrLaterProtocolRequest risolve RequestContext.JsonRpcRequest.Context.ProtocolVersion e McpServer.NegotiatedProtocolVersion. Confronta le policy proposte prima di sceglierne una, quindi segui l’emissione dei risultati normali, memorizzabili nella cache e alternativi immediati. Il lavoro è completato quando il comportamento scelto è definito e i test dell’esatta forma wire coprono i contesti di protocollo, gli handler, i filtri e le istanze di risultato riutilizzate elencati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
PR #1753 fixes #1721 by stopping the SDK from automatically adding the 2026-07-28-only resultType, ttlMs, and cacheScope properties to legacy results. Applications can still set those properties explicitly from handlers or filters, which can produce a wire shape that is invalid for the negotiated protocol version.
We should define and consistently enforce the server behavior for protocol-version-specific result properties supplied by application code.
Protocol detection
The effective protocol version is already available at the shared post-handler boundary:
- Use
RequestContext.JsonRpcRequest.Context.ProtocolVersionfor per-request metadata protocols. - Fall back to
McpServer.NegotiatedProtocolVersionfor stateful sessions. McpServerImpl.IsJuly2026OrLaterProtocolRequestalready implements this resolution.
Possible policies
- Fail the request before serialization with an InternalError and a useful server-side diagnostic. This gives application developers the strongest signal, but turns an otherwise valid client request into an error. Ordinary application exceptions currently produce a generic
"An error occurred."response, so we would also need to decide whether the client receives a specific message. - Strip the unsupported properties and log a warning. This preserves a valid legacy wire shape while making the application misuse visible to server operators.
- Strip the unsupported properties silently. This maximizes compatibility but can hide application bugs.
Scope
The selected policy should:
- Be applied once at a typed response-emission boundary after handlers and filters.
- Cover
Result.ResultTypeand bothICacheableResultproperties. - Cover normal, cacheable, and immediate alternate results.
- Avoid mutating shared response instances in a way that can affect later requests using another protocol version.
- Preserve explicit values and add required defaults for 2026-07-28 and later responses.
- Be extensible to future protocol-version-specific result properties.
Tests
Add exact serialized wire-shape coverage for:
- Legacy handlers and filters that explicitly set each unsupported property.
- 2026-07-28 handlers and filters with explicit values.
- Normal, cacheable, and immediate alternate results.
- Session-negotiated and per-request HTTP protocol contexts.
- Reused or shared result instances across requests with different protocol versions.
- Lingua principale
- C#
- Stelle
- 4.5k
- Fork
- 814
- Merge medio
- 9g 19h
- PR unite (30g)
- 4
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di modelcontextprotocol/csharp-sdk
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
modelcontextprotocol/csharp-sdk#1867 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
modelcontextprotocol/csharp-sdk#1840 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
modelcontextprotocol/csharp-sdk#1836 ·
-
enhancement needs confirmation
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
modelcontextprotocol/csharp-sdk#678 · 1 commento ·
-
enhancement needs confirmation P3 ready for work
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
modelcontextprotocol/csharp-sdk#515 · 6 commenti · 3 reazioni ·
Tutte le issue di modelcontextprotocol/csharp-sdk
Issue simili
-
type/automation type/tech-debt
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
t/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
ci-failure-cause test-failure
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
area:auth FE mvp P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
klasolsson81/jobbliggaren#1788 ·