Application-owned state shared across MCP requests.
Application sessions reuse the configured FastestMCP.SessionStateStore but
are deliberately separate from MCP transport sessions. The current session
is a private bucket for one authenticated principal. Explicit sessions have
opaque public identifiers and must be fetched again in each request.
Explicit sessions are principal-scoped by default. A server may opt into
anonymous bearer sessions with application_sessions: [allow_anonymous: true].
Summary
Functions
Creates a new explicit application session.
Creates a new explicit application session or raises.
Returns the authenticated principal's application-session bucket.
Returns the authenticated principal's application-session bucket or raises.
Deletes one value from the application session.
Fetches an explicit application session visible to the current caller.
Fetches an explicit application session or raises.
Reads a value, returning the supplied default when the key is absent.
Returns an explicit application's public session identifier, or nil for current/1.
Stores a value in the application session.
Terminates an explicit application session and removes all of its values.
Types
Functions
@spec create(FastestMCP.Context.t()) :: {:ok, t()} | {:error, FastestMCP.Error.t()}
Creates a new explicit application session.
@spec create!(FastestMCP.Context.t()) :: t()
Creates a new explicit application session or raises.
@spec current(FastestMCP.Context.t()) :: {:ok, t()} | {:error, FastestMCP.Error.t()}
Returns the authenticated principal's application-session bucket.
@spec current!(FastestMCP.Context.t()) :: t()
Returns the authenticated principal's application-session bucket or raises.
@spec delete(t(), term()) :: :ok | {:error, FastestMCP.Error.t()}
Deletes one value from the application session.
@spec fetch(FastestMCP.Context.t(), String.t()) :: {:ok, t()} | {:error, FastestMCP.Error.t()}
Fetches an explicit application session visible to the current caller.
@spec fetch!(FastestMCP.Context.t(), String.t()) :: t()
Fetches an explicit application session or raises.
@spec get(t(), term(), term()) :: {:ok, term()} | {:error, FastestMCP.Error.t()}
Reads a value, returning the supplied default when the key is absent.
Returns an explicit application's public session identifier, or nil for current/1.
@spec put(t(), term(), term()) :: :ok | {:error, FastestMCP.Error.t()}
Stores a value in the application session.
@spec terminate(t()) :: :ok | {:error, FastestMCP.Error.t()}
Terminates an explicit application session and removes all of its values.