pub struct SessionRpcMcp<'a> { /* private fields */ }Expand description
session.mcp.* RPCs.
Implementations§
Source§impl<'a> SessionRpcMcp<'a>
impl<'a> SessionRpcMcp<'a>
Sourcepub fn apps(&self) -> SessionRpcMcpApps<'a>
pub fn apps(&self) -> SessionRpcMcpApps<'a>
session.mcp.apps.* sub-namespace.
Sourcepub fn headers(&self) -> SessionRpcMcpHeaders<'a>
pub fn headers(&self) -> SessionRpcMcpHeaders<'a>
session.mcp.headers.* sub-namespace.
Sourcepub fn oauth(&self) -> SessionRpcMcpOauth<'a>
pub fn oauth(&self) -> SessionRpcMcpOauth<'a>
session.mcp.oauth.* sub-namespace.
Sourcepub fn resources(&self) -> SessionRpcMcpResources<'a>
pub fn resources(&self) -> SessionRpcMcpResources<'a>
session.mcp.resources.* sub-namespace.
Sourcepub async fn list(&self) -> Result<McpServerList, Error>
pub async fn list(&self) -> Result<McpServerList, Error>
Lists MCP servers configured for the session, their connection status, and host-level state. The host-level state (disabled/filtered servers, failed/needs-auth/pending connections, mcp3p policy, full config) is empty/zero when no MCP host has been initialized for the session.
Wire method: session.mcp.list.
§Returns
MCP servers configured for the session, with their connection status and host-level state.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn list_tools(
&self,
params: McpListToolsRequest,
) -> Result<McpListToolsResult, Error>
pub async fn list_tools( &self, params: McpListToolsRequest, ) -> Result<McpListToolsResult, Error>
Lists the tools exposed by a connected MCP server on this session’s host.
Wire method: session.mcp.listTools.
§Parameters
params- Server name whose tool list should be returned.
§Returns
Tools exposed by the connected MCP server. Throws when the server is not connected.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn enable(&self, params: McpEnableRequest) -> Result<(), Error>
pub async fn enable(&self, params: McpEnableRequest) -> Result<(), Error>
Enables an MCP server for the session.
Wire method: session.mcp.enable.
§Parameters
params- Name of the MCP server to enable for the session.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn disable(&self, params: McpDisableRequest) -> Result<(), Error>
pub async fn disable(&self, params: McpDisableRequest) -> Result<(), Error>
Disables an MCP server for the session.
Wire method: session.mcp.disable.
§Parameters
params- Name of the MCP server to disable for the session.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn reload(&self) -> Result<(), Error>
pub async fn reload(&self) -> Result<(), Error>
Reloads MCP server connections for the session.
Wire method: session.mcp.reload.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn execute_sampling(
&self,
params: McpExecuteSamplingParams,
) -> Result<McpSamplingExecutionResult, Error>
pub async fn execute_sampling( &self, params: McpExecuteSamplingParams, ) -> Result<McpSamplingExecutionResult, Error>
Runs an MCP sampling inference on behalf of an MCP server.
Wire method: session.mcp.executeSampling.
§Parameters
params- Identifiers and raw MCP CreateMessageRequest params used to run a sampling inference.
§Returns
Outcome of an MCP sampling execution: success result, failure error, or cancellation.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn cancel_sampling_execution(
&self,
params: McpCancelSamplingExecutionParams,
) -> Result<McpCancelSamplingExecutionResult, Error>
pub async fn cancel_sampling_execution( &self, params: McpCancelSamplingExecutionParams, ) -> Result<McpCancelSamplingExecutionResult, Error>
Cancels an in-flight MCP sampling execution by request ID.
Wire method: session.mcp.cancelSamplingExecution.
§Parameters
params- The requestId previously passed to executeSampling that should be cancelled.
§Returns
Indicates whether an in-flight sampling execution with the given requestId was found and cancelled.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn set_env_value_mode(
&self,
params: McpSetEnvValueModeParams,
) -> Result<McpSetEnvValueModeResult, Error>
pub async fn set_env_value_mode( &self, params: McpSetEnvValueModeParams, ) -> Result<McpSetEnvValueModeResult, Error>
Sets how environment-variable values supplied to MCP servers are resolved (direct or indirect).
Wire method: session.mcp.setEnvValueMode.
§Parameters
params- Mode controlling how MCP server env values are resolved (directorindirect).
§Returns
Env-value mode recorded on the session after the update.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn remove_git_hub(&self) -> Result<McpRemoveGitHubResult, Error>
pub async fn remove_git_hub(&self) -> Result<McpRemoveGitHubResult, Error>
Removes the auto-managed github MCP server when present.
Wire method: session.mcp.removeGitHub.
§Returns
Indicates whether the auto-managed github MCP server was removed (false when nothing to remove).
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn start_server(
&self,
params: McpStartServerRequest,
) -> Result<(), Error>
pub async fn start_server( &self, params: McpStartServerRequest, ) -> Result<(), Error>
Starts an individual MCP server on the live session from a caller-supplied config. Session-scoped and ephemeral: the server is added to this session’s running set only and is reaped when the session ends. Does NOT modify persistent user configuration (mcp.config.*), so it does not affect future sessions. The server surfaces through session.mcp.list and the session.mcp_servers_loaded / session.mcp_server_status_changed events like any other server.
Wire method: session.mcp.startServer.
§Parameters
params- Server name and configuration for an individual MCP server start.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn restart_server(
&self,
params: McpRestartServerRequest,
) -> Result<(), Error>
pub async fn restart_server( &self, params: McpRestartServerRequest, ) -> Result<(), Error>
Restarts an individual MCP server on the live session (stops then starts). Omit config for a config-free restart-by-name of an already-configured server; supply config to restart with a replacement configuration. Session-scoped and ephemeral: does NOT modify persistent user configuration (mcp.config.*).
Wire method: session.mcp.restartServer.
§Parameters
params- Server name and optional replacement configuration for an individual MCP server restart. Omitconfigfor a config-free restart-by-name of an already-configured server.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn stop_server(
&self,
params: McpStopServerRequest,
) -> Result<(), Error>
pub async fn stop_server( &self, params: McpStopServerRequest, ) -> Result<(), Error>
Stops an individual MCP server on the session’s host.
Wire method: session.mcp.stopServer.
§Parameters
params- Server name for an individual MCP server stop.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Sourcepub async fn is_server_running(
&self,
params: McpIsServerRunningRequest,
) -> Result<McpIsServerRunningResult, Error>
pub async fn is_server_running( &self, params: McpIsServerRunningRequest, ) -> Result<McpIsServerRunningResult, Error>
Checks whether a named MCP server is currently running on the session’s host.
Wire method: session.mcp.isServerRunning.
§Parameters
params- Server name to check running status for.
§Returns
Whether the named MCP server is running.
Experimental. This API is part of an experimental wire-protocol surface and may change or be removed in future SDK or CLI releases. Pin both the SDK and CLI versions if your code depends on it.
Trait Implementations§
Source§impl<'a> Clone for SessionRpcMcp<'a>
impl<'a> Clone for SessionRpcMcp<'a>
Source§fn clone(&self) -> SessionRpcMcp<'a>
fn clone(&self) -> SessionRpcMcp<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more