Skip to main content

McpConnectionManager

Struct McpConnectionManager 

Source
pub struct McpConnectionManager { /* private fields */ }
Expand description

A thin wrapper around a set of running [RmcpClient] instances.

Implementations§

Source§

impl McpConnectionManager

Source

pub async fn validate_required_servers(&self) -> Result<()>

Waits for every required server and reports their startup failures together.

Callers must make the manager reachable to request handlers before awaiting this method, because server initialization may require client elicitation.

Source§

impl McpConnectionManager

Source

pub async fn list_all_tools(&self) -> Vec<ToolInfo>

Returns all tools with model-visible names normalized.

Source

pub async fn tool_info(&self, server: &str, tool: &str) -> Option<ToolInfo>

Returns one tool from the current live connection.

Source

pub async fn capture_binding_with_metadata( self: &Arc<Self>, config: Arc<McpConfig>, plugins_available: bool, ) -> McpBinding

Captures the ready clients, their exact tools, and the supplied runtime metadata.

Source

pub async fn hard_refresh_codex_apps_tools_cache(&self) -> Result<Vec<ToolInfo>>

Force-refresh codex apps tools by bypassing the in-process cache.

On success, the refreshed tools replace shared cache contents when the cache is enabled and the latest filtered tools are returned directly to the caller. On failure, existing shared cache contents remain unchanged.

Source§

impl McpConnectionManager

Source

pub async fn new( mcp_servers: &HashMap<String, EffectiveMcpServer>, store_mode: OAuthCredentialsStoreMode, keyring_backend_kind: AuthKeyringBackendKind, approval_policy: &Constrained<AskForApproval>, submit_id: String, tx_event: Option<Sender<Event>>, startup_cancellation_token: CancellationToken, initial_permission_profile: PermissionProfile, runtime_context: McpRuntimeContext, codex_home: PathBuf, codex_apps_tools_cache: ConnectorRuntimeManager<ToolInfo>, tool_catalog_cache: McpToolCatalogCache, codex_apps_tools_cache_key: ConnectorRuntimeContextKey, prefix_mcp_tool_names: bool, client_elicitation_capability: ElicitationCapability, supports_openai_form_elicitation: bool, tool_plugin_provenance: ToolPluginProvenance, auth: Option<&CodexAuth>, codex_apps_auth_manager: Option<Arc<AuthManager>>, elicitation_reviewer: Option<ElicitationReviewerHandle>, elicitation_lifecycle: Option<ElicitationLifecycle>, elicitation_router: ElicitationRequestRouter, ) -> Self

Creates an MCP connection manager. Threadless callers can pass no tx_event; startup notifications are then skipped and interactive elicitations are declined.

Source

pub fn new_uninitialized_with_permission_profile( approval_policy: &Constrained<AskForApproval>, permission_profile: &PermissionProfile, prefix_mcp_tool_names: bool, ) -> Self

Source

pub fn empty(prefix_mcp_tool_names: bool) -> Self

Source

pub fn has_servers(&self) -> bool

Source

pub async fn shutdown(&self)

Stop all MCP clients owned by this manager and terminate stdio server processes.

Source

pub fn server_origin(&self, server_name: &str) -> Option<&str>

Source

pub fn server_environment_id(&self, server_name: &str) -> Option<&str>

Source

pub fn server_pollutes_memory(&self, server_name: &str) -> bool

Source

pub fn plugin_id_for_mcp_server_name(&self, server_name: &str) -> Option<&str>

Source

pub fn is_selected_plugin_mcp_server(&self, server_name: &str) -> bool

Source

pub fn tool_approval_mode( &self, server_name: &str, tool_name: &str, ) -> AppToolApproval

Source

pub fn is_host_owned_codex_apps_server(&self, server_name: &str) -> bool

Source

pub fn set_approval_policy(&self, approval_policy: &Constrained<AskForApproval>)

Source

pub fn set_permission_profile(&self, permission_profile: PermissionProfile)

Source

pub fn elicitations_auto_deny(&self) -> bool

Source

pub fn set_elicitations_auto_deny(&self, auto_deny: bool)

Source

pub fn elicitation_router(&self) -> ElicitationRequestRouter

Source

pub async fn resolve_elicitation( &self, server_name: String, id: RequestId, response: ElicitationResponse, ) -> Result<()>

Source

pub async fn wait_for_server_ready( &self, server_name: &str, timeout: Duration, ) -> bool

Source

pub async fn list_all_resources( &self, include_server: impl Fn(&str) -> bool, ) -> HashMap<String, Vec<Resource>>

Returns resources from servers selected by include_server. Each key is the server name and the value is a vector of resources.

Source

pub async fn list_all_resource_templates( &self, include_server: impl Fn(&str) -> bool, ) -> HashMap<String, Vec<ResourceTemplate>>

Returns resource templates from servers selected by include_server. Each key is the server name and the value is a vector of templates.

Source

pub async fn call_tool( &self, server: &str, tool: &str, arguments: Option<Value>, meta: Option<Value>, ) -> Result<CallToolResult>

Invoke the tool indicated by the (server, tool) pair.

Source

pub async fn server_supports_sandbox_state_meta_capability( &self, server: &str, ) -> Result<bool>

Source

pub async fn list_resources( &self, server: &str, params: Option<PaginatedRequestParams>, ) -> Result<ListResourcesResult>

List resources from the specified server.

Source

pub async fn list_resource_templates( &self, server: &str, params: Option<PaginatedRequestParams>, ) -> Result<ListResourceTemplatesResult>

List resource templates from the specified server.

Source

pub async fn read_resource( &self, server: &str, params: ReadResourceRequestParams, ) -> Result<ReadResourceResult>

Read a resource from the specified server.

Trait Implementations§

Source§

impl Drop for McpConnectionManager

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> AsTypeStaticRegistered for T

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> HasTyVTable for T
where T: ?Sized,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> RamaFrom<T> for U
where U: From<T>,

Source§

fn rama_from(value: T) -> U

Source§

impl<T, U, CrateMarker> RamaInto<U, CrateMarker> for T
where U: RamaFrom<T, CrateMarker>,

Source§

fn rama_into(self) -> U

Source§

impl<T, U> RamaTryFrom<T> for U
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

Source§

fn rama_try_from(value: T) -> Result<U, <U as RamaTryFrom<T>>::Error>

Source§

impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for T
where U: RamaTryFrom<T, CrateMarker>,

Source§

type Error = <U as RamaTryFrom<T, CrateMarker>>::Error

Source§

fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T, CrateMarker>>::Error>

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToAst for T

Source§

fn ast(self, begin: usize, end: usize) -> Spanned<Self>

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more