session
A bucket-backed session keyed by the Mcp-Session-Id HTTP header.
resource session;F id
id: func() -> string;Get the session ID.
F get
get: func(key: string) -> result<option<list<u8>>, session-error>;Get a persistent session value by key.
F set
set: func(key: string, value: list<u8>) -> result<_, session-error>;Set a persistent session value by key.
F elicit
elicit: func(client: borrow<client-notifier>, elicitation: elicit-request) -> result<future-elicit-result, session-error>;Elicit information from the client.
The result is a future that can be polled to check when the result is ready. The actual result can then be obtained from the future.
https://modelcontextprotocol.io/specification/2025-06-18/client/elicitation
F terminate
terminate: func(reason: option<string>) -> result<_, session-error>;Idempotently terminate the session, optionally providing a reason.
Data associated with the terminated session is NOT deleted. Use delete() to remove all session data.
F is-terminated
is-terminated: func() -> result<bool, session-error>;Check if the session is terminated.
F initialize
initialize: func(bucket: bucket) -> result<session, session-error>;Initialize a new session in the given bucket. A cryptographically unique session ID is generated.
F open
open: func(bucket: bucket, id: string) -> result<session, session-error>;Open an existing session by ID in the given bucket.
F close
Close the session.
F delete
delete: func(session: session) -> result<bucket, tuple<bucket, session-error>>;Delete the session and all associated data in the bucket.