An opened, request-scoped MCP subscription.
Applications implement Snodo.Subscription.Source; this module owns filter
narrowing, lifecycle safety, bounded pulling, and protocol wire shaping.
Summary
Functions
Returns the first required acknowledgement notification.
Closes the application-owned source handle with an explicit reason.
Returns the final successful JSON-RPC response for graceful completion.
Returns a terminal JSON-RPC error response for a failed open stream.
Shapes one requested source event or drops an event outside the accepted filter.
Starts a monitored, demand-driven source worker owned by the caller.
Allows a subscription worker to pull exactly one more source outcome.
Stops a worker and removes its process monitor.
Types
@type t() :: %Snodo.Subscription{ accepted_filter: map(), context: Snodo.Context.t(), extension_filters: %{optional(String.t()) => map()}, extension_registry: Snodo.Extension.Registry.t(), handle: term(), id: id(), protocol: module(), source: Snodo.Subscription.Source.Config.t() }
Functions
@spec acknowledgement(t()) :: {:ok, map()} | {:error, Snodo.Error.t()}
Returns the first required acknowledgement notification.
@spec close(t(), Snodo.Subscription.Source.close_reason()) :: :ok
Closes the application-owned source handle with an explicit reason.
@spec completion(t()) :: {:ok, map()} | {:error, Snodo.Error.t()}
Returns the final successful JSON-RPC response for graceful completion.
Returns a terminal JSON-RPC error response for a failed open stream.
@spec notification(t(), Snodo.Subscription.Event.t()) :: {:ok, map()} | :drop | {:error, Snodo.Error.t()}
Shapes one requested source event or drops an event outside the accepted filter.
@spec open(Snodo.Subscription.Source.Config.t(), map(), Snodo.Context.t()) :: {:ok, t()} | {:error, Snodo.Error.t()}
Starts a monitored, demand-driven source worker owned by the caller.
After each continue/1, the owner receives
{:mcp_subscription, worker, outcome} where the outcome is {:ok, event},
:closed, or {:error, reason}.
Allows a subscription worker to pull exactly one more source outcome.
Stops a worker and removes its process monitor.