proposal: ClientOptions.ResourceSubscriptionEndedHandler for observing resource-subscription termination
I maintainer di solito rispondono entro 1 giorno
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
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- go
- Ambito
- api, backend-api-design
Direzione di ricerca
Start by reviewing ClientOptions, ResourceSubscriptionEndedRequest, and the resource-subscription lifecycle described in the issue, then compare the behavior with related issue #1283. Done means the exported API shape and callback semantics are approved, including handling of client-initiated versus remote termination, before implementation begins.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Motivation
#1283 fixes a bug where a resource subscription whose subscriptions/listen stream ends (server teardown, revoked resource, dropped connection) leaves a stale internal entry, so a bare re-Subscribe no-ops. That PR clears the subscription silently so re-Subscribe re-opens it, with no new exported API.
Silent cleanup, though, gives the application no way to observe that a subscription ended or to react to it — reconnect with its own backoff, surface a UI state, stop retrying. Today a client gets no signal at all when a live subscription dies underneath it.
Proposed API
type ClientOptions struct {
// ...
// ResourceSubscriptionEndedHandler is called (under SEP-2575) when the
// subscriptions/listen stream backing a Subscribe ends for a reason other
// than a client-initiated Unsubscribe or Close.
ResourceSubscriptionEndedHandler func(context.Context, *ResourceSubscriptionEndedRequest)
}
// ResourceSubscriptionEndedRequest describes a resource subscription whose
// SEP-2575 subscriptions/listen stream has ended without a client-initiated
// Unsubscribe or Close.
type ResourceSubscriptionEndedRequest struct {
URI string // the resource whose subscription ended
Err error // the terminating error, or nil on a graceful listen result
Graceful bool // whether it ended with a normal result rather than an error
}
Semantics
- Opt-in. A nil handler keeps the #1283 behavior exactly: the subscription is cleared silently and a bare re-
Subscribere-opens it. - The SDK does not auto-resubscribe — a permanently revoked URI would hot-loop. The application owns retry/backoff and may call
Subscribeagain for the URI from within the handler. This is safe: the entry is cleared before the handler fires, and a per-subscription generation guard makes re-subscribe-from-callback (and anUnsubscribe→Subscriberace) well-defined. - Fires only for non-client-initiated ends;
UnsubscribeandClosedo not invoke it.
Cross-SDK context
The python and typescript SDKs already surface subscription-termination signals to callers (python raises on subscription loss / ends the async iteration; typescript reports a close reason distinguishing local vs graceful vs remote). This proposal gives Go clients an equivalent, idiomatic callback.
Process
This adds exported API (ResourceSubscriptionEndedHandler, ResourceSubscriptionEndedRequest), so per CONTRIBUTING it goes through the proposal process — filing ahead of a PR. A working implementation already exists (it was the original form of #1283, before the behavior fix was split out to land without new API); happy to open the PR once the shape is approved.
Related: #1283 (behavior-only fix, no new exported API).
- Lingua principale
- Go
- Stelle
- 5.4k
- Fork
- 623
- Merge medio
- 22h 10m
- PR unite (30g)
- 30
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi 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/go-sdk
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
modelcontextprotocol/go-sdk#1557 ·
I maintainer di solito rispondono entro 1 giorno
-
Streamable HTTP (2026-07-28): tools/call with an out-of-range number in arguments fails because extractName decodes Arguments into anyForse di nuovo libera @beiryu l’ha presa 10 giorni fa e non c’è nessuna pull request aperta. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
modelcontextprotocol/go-sdk#1534 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Expose generic `SendNotification` on `ServerSession` for custom protocol extensionsForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertaneeds investigation
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
modelcontextprotocol/go-sdk#745 · 13 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 18/100
modelcontextprotocol/go-sdk#1555 ·
I maintainer di solito rispondono entro 1 giorno
-
mcp: 2026-07-28 client runs elicitation and sampling handlers for standalone server requestsForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
modelcontextprotocol/go-sdk#1552 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di modelcontextprotocol/go-sdk
Issue simili
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
compiler-explorer/compiler-explorer#9738 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
evilmartians/lefthook#1674 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno