#[non_exhaustive]pub enum McpConnectionContext {
Standalone,
#[non_exhaustive] Acp {
server_id: McpServerAcpId,
request_id: McpRequestId,
session_id: Option<SessionId>,
tool_call_id: Option<ToolCallId>,
},
}Expand description
Describes how an MCP server connection was established.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Standalone
The MCP server was connected directly, without an ACP transport.
#[non_exhaustive]Acp
unstable_mcp_over_acp only.The MCP server was attached to an ACP session.
Fields
This variant is marked as non-exhaustive
server_id: McpServerAcpIdThe identifier advertised in the session’s McpServer::Acp declaration.
request_id: McpRequestIdThe logical identifier of this independent MCP request.
session_id: Option<SessionId>The session the Agent says this request was sent for, if it supplied one. The SDK does not check it.
tool_call_id: Option<ToolCallId>The tool call in that session that the Agent says this request is part of, if it supplied one.
Implementations§
Source§impl McpConnectionContext
impl McpConnectionContext
Sourcepub fn is_standalone(&self) -> bool
pub fn is_standalone(&self) -> bool
Whether this MCP connection was established without an ACP transport.
Sourcepub fn server_id(&self) -> Option<&McpServerAcpId>
Available on crate feature unstable_mcp_over_acp only.
pub fn server_id(&self) -> Option<&McpServerAcpId>
unstable_mcp_over_acp only.The identifier advertised in the session’s McpServer::Acp declaration.
Returns None for a standalone MCP connection.
Sourcepub fn request_id(&self) -> Option<&McpRequestId>
Available on crate feature unstable_mcp_over_acp only.
pub fn request_id(&self) -> Option<&McpRequestId>
unstable_mcp_over_acp only.The logical identifier of the active MCP request.
Returns None for a standalone MCP connection.
Sourcepub fn session_id(&self) -> Option<&SessionId>
Available on crate feature unstable_mcp_over_acp only.
pub fn session_id(&self) -> Option<&SessionId>
unstable_mcp_over_acp only.The session the Agent says this request was sent for.
Returns None for a standalone MCP connection, and when the Agent
supplied no session. For a child session’s work this is the child’s ID.
The SDK does not check the value. Before you use it to choose what a request acts on, check that the session is active on the connection, or is a child that the Agent announced for an active session, and that this server was declared to it or to one of its ancestors.
Sourcepub fn tool_call_id(&self) -> Option<&ToolCallId>
Available on crate feature unstable_mcp_over_acp only.
pub fn tool_call_id(&self) -> Option<&ToolCallId>
unstable_mcp_over_acp only.The tool call, in the session returned by session_id, that the Agent
says this request is part of.
Returns None for a standalone MCP connection, and when the Agent
supplied no tool call. The Agent can report the tool call after it
sends the request, so the ID might not be known yet.
Trait Implementations§
Source§impl Clone for McpConnectionContext
impl Clone for McpConnectionContext
Source§impl Debug for McpConnectionContext
impl Debug for McpConnectionContext
impl Eq for McpConnectionContext
Source§impl PartialEq for McpConnectionContext
impl PartialEq for McpConnectionContext
impl StructuralPartialEq for McpConnectionContext
Auto Trait Implementations§
impl Forget for McpConnectionContext
impl Freeze for McpConnectionContext
impl Move for McpConnectionContext
impl RefUnwindSafe for McpConnectionContext
impl Send for McpConnectionContext
impl Sync for McpConnectionContext
impl Unpin for McpConnectionContext
impl UnsafeUnpin for McpConnectionContext
impl UnwindSafe for McpConnectionContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.