pub struct McpSession {
pub id: String,
pub initialized: bool,
pub client_info: Option<Expr>,
pub protocol_version: String,
pub profile: McpProfile,
pub native_cards: Vec<McpNativeCard>,
pub granted_capabilities: Vec<CapabilityName>,
pub deadline_ms: Option<u64>,
pub rate_limit: Option<usize>,
pub active_request_limit: Option<usize>,
pub active_requests: BTreeSet<String>,
pub shutdown_requested: bool,
/* private fields */
}Expand description
Mutable per-connection MCP session state.
Tracks the handshake, the visibility profile, granted capabilities, and the in-flight request bookkeeping used to enforce deadline, rate, and concurrency boundaries.
Fields§
§id: StringStable session identifier.
initialized: boolWhether the initialize handshake has completed.
client_info: Option<Expr>Client info reported during initialization, if any.
protocol_version: StringNegotiated MCP protocol version.
profile: McpProfileVisibility profile filtering the surface for this session.
native_cards: Vec<McpNativeCard>Native cards exposed through this session.
granted_capabilities: Vec<CapabilityName>Capabilities granted to this session.
deadline_ms: Option<u64>Optional per-request deadline budget, in milliseconds.
rate_limit: Option<usize>Optional cap on the total number of requests admitted.
active_request_limit: Option<usize>Optional cap on concurrently active requests.
active_requests: BTreeSet<String>Identifiers of currently in-flight requests.
shutdown_requested: boolWhether the peer has requested shutdown.
Implementations§
Source§impl McpSession
impl McpSession
Sourcepub fn new(id: impl Into<String>, profile: McpProfile) -> Self
pub fn new(id: impl Into<String>, profile: McpProfile) -> Self
Creates a session with the given id and visibility profile.
Sourcepub fn with_native_cards(self, cards: Vec<McpNativeCard>) -> Self
pub fn with_native_cards(self, cards: Vec<McpNativeCard>) -> Self
Returns the session with its native cards replaced by cards.
Sourcepub fn with_granted_capability(self, capability: CapabilityName) -> Self
pub fn with_granted_capability(self, capability: CapabilityName) -> Self
Returns the session with capability added to the granted set.
Sourcepub fn with_deadline_ms(self, deadline_ms: u64) -> Self
pub fn with_deadline_ms(self, deadline_ms: u64) -> Self
Returns the session with a per-request deadline_ms budget.
Sourcepub fn with_rate_limit(self, limit: usize) -> Self
pub fn with_rate_limit(self, limit: usize) -> Self
Returns the session with a total request limit.
Sourcepub fn with_active_request_limit(self, limit: usize) -> Self
pub fn with_active_request_limit(self, limit: usize) -> Self
Returns the session with a concurrent active-request limit.
Trait Implementations§
Source§impl Clone for McpSession
impl Clone for McpSession
Source§fn clone(&self) -> McpSession
fn clone(&self) -> McpSession
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more