pub struct McpContext {
pub client_name: Option<String>,
pub client_version: Option<String>,
pub session_id: Option<String>,
pub auth_claims: Option<String>,
}Expand description
Per-request context passed to tool handlers registered via
McpServer::tool_with_context — caller identity and session info that a
plain Fn(&str) -> ... tool handler has no way to see.
Constructed in McpServer::execute from the current request’s headers
plus whatever clientInfo was recorded for this session at initialize
time (see McpServer::handle_request_with_context).
Fields§
§client_name: Option<String>clientInfo.name sent in this session’s initialize call, if the
client sent one and this request carries a recognized Mcp-Session-Id.
client_version: Option<String>clientInfo.version sent in this session’s initialize call, under
the same conditions as client_name.
session_id: Option<String>The Mcp-Session-Id header on this request, if present — the value
the server minted and returned in the initialize response header
for this session (see the module docs’ Sessions section).
auth_claims: Option<String>Verified JWT claims as a JSON string. Not populated by anything in
this crate yet — reserved for a future JWT-auth integration
(MCP_TODO.md TODO-11/TODO-13); always None today.
Trait Implementations§
Source§impl Clone for McpContext
impl Clone for McpContext
Source§fn clone(&self) -> McpContext
fn clone(&self) -> McpContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more