nimwire/subscriptions
This page is generated from the module’s exported API and ## documentation comments.
In-process change notification bus for modern MCP subscriptions.
McpSubscriptionEventKind
Section titled “McpSubscriptionEventKind”McpSubscriptionEventKind = enum mcpToolsListChanged, mcpPromptsListChanged, mcpResourcesListChanged, mcpResourceUpdatedMcpSubscriptionFilter
Section titled “McpSubscriptionFilter”McpSubscriptionFilter = object toolsListChanged*: bool promptsListChanged*: bool resourcesListChanged*: bool resourceSubscriptions*: seq[string]McpSubscriptionEvent
Section titled “McpSubscriptionEvent”McpSubscriptionEvent = object kind*: McpSubscriptionEventKind uri*: stringMcpSubscriptionMessageHandler
Section titled “McpSubscriptionMessageHandler”McpSubscriptionMessageHandler = proc (message: JsonNode) {.closure.}McpEventPublisher
Section titled “McpEventPublisher”McpEventPublisher = proc (event: McpSubscriptionEvent) {.closure.}McpSubscriptionCloseHandler
Section titled “McpSubscriptionCloseHandler”McpSubscriptionCloseHandler = proc (subscription: McpSubscription; graceful: bool) {.closure.}McpSubscription
Section titled “McpSubscription”McpSubscription = ref object id*: McpId filter*: McpSubscriptionFilter active*: boolMcpEventBus
Section titled “McpEventBus”McpEventBus = ref objectProcedures
Section titled “Procedures”newMcpEventBus
Section titled “newMcpEventBus”proc newMcpEventBus(publisher: McpEventPublisher = nil): McpEventBus {. raises: [], tags: [], forbids: [].}Returns: McpEventBus.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
publisher |
McpEventPublisher |
nil |
subscribe
Section titled “subscribe”proc subscribe(bus: McpEventBus; id: McpId; filter: McpSubscriptionFilter; handler: McpSubscriptionMessageHandler): McpSubscription {. raises: [McpError], tags: [], forbids: [].}Returns: McpSubscription.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
bus |
McpEventBus |
|
id |
McpId |
|
filter |
McpSubscriptionFilter |
|
handler |
McpSubscriptionMessageHandler |
activate
Section titled “activate”proc activate(subscription: McpSubscription) {.raises: [], tags: [], forbids: [].}Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
subscription |
McpSubscription |
unsubscribe
Section titled “unsubscribe”proc unsubscribe(bus: McpEventBus; subscription: McpSubscription): bool {. raises: [Exception], tags: [RootEffect], forbids: [].}Returns: bool.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
bus |
McpEventBus |
|
subscription |
McpSubscription |
setCloseHandler
Section titled “setCloseHandler”proc setCloseHandler(subscription: McpSubscription; handler: McpSubscriptionCloseHandler) {.raises: [], tags: [], forbids: [].}Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
subscription |
McpSubscription |
|
handler |
McpSubscriptionCloseHandler |
proc close(subscription: McpSubscription; graceful = true) {. raises: [Exception], tags: [RootEffect], forbids: [].}Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
subscription |
McpSubscription |
|
graceful |
inferred |
true |
isActive
Section titled “isActive”proc isActive(subscription: McpSubscription): bool {.raises: [], tags: [], forbids: [].}Returns: bool.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
subscription |
McpSubscription |
waitClosed
Section titled “waitClosed”proc waitClosed(subscription: McpSubscription): Future[void] {. raises: [McpError], tags: [], forbids: [].}Returns: Future[void].
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
subscription |
McpSubscription |
notification
Section titled “notification”proc notification(subscription: McpSubscription; event: McpSubscriptionEvent): JsonNode {. raises: [KeyError], tags: [], forbids: [].}Returns: JsonNode.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
subscription |
McpSubscription |
|
event |
McpSubscriptionEvent |
deliver
Section titled “deliver”proc deliver(subscription: McpSubscription; message: JsonNode) {. raises: [Exception], tags: [RootEffect], forbids: [].}Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
subscription |
McpSubscription |
|
message |
JsonNode |
publish
Section titled “publish”proc publish(bus: McpEventBus; event: McpSubscriptionEvent) {. raises: [Exception, KeyError], tags: [RootEffect], forbids: [].}Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
bus |
McpEventBus |
|
event |
McpSubscriptionEvent |
publishToolsChanged
Section titled “publishToolsChanged”proc publishToolsChanged(bus: McpEventBus) {.raises: [Exception, KeyError], tags: [RootEffect], forbids: [].}Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
bus |
McpEventBus |
publishPromptsChanged
Section titled “publishPromptsChanged”proc publishPromptsChanged(bus: McpEventBus) {.raises: [Exception, KeyError], tags: [RootEffect], forbids: [].}Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
bus |
McpEventBus |
publishResourcesChanged
Section titled “publishResourcesChanged”proc publishResourcesChanged(bus: McpEventBus) {.raises: [Exception, KeyError], tags: [RootEffect], forbids: [].}Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
bus |
McpEventBus |
publishResourceUpdated
Section titled “publishResourceUpdated”proc publishResourceUpdated(bus: McpEventBus; uri: string) {. raises: [Exception, KeyError], tags: [RootEffect], forbids: [].}Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
bus |
McpEventBus |
|
uri |
string |