pub struct McpConnectionTo<Counterpart: Role> { /* private fields */ }Expand description
Connection information available to an MCP server.
Implementations§
Source§impl<Counterpart: Role> McpConnectionTo<Counterpart>
impl<Counterpart: Role> McpConnectionTo<Counterpart>
Sourcepub fn context(&self) -> &McpConnectionContext
pub fn context(&self) -> &McpConnectionContext
Describes whether this is a standalone or ACP-attached MCP connection.
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.
Sourcepub fn connection(&self) -> &ConnectionTo<Counterpart>
pub fn connection(&self) -> &ConnectionTo<Counterpart>
Borrow the host protocol connection.
For an ACP-attached server, this is its host ACP connection. For a standalone server, this is the direct MCP client connection.