pub struct ExternalToolRuntime { /* private fields */ }Expand description
A single role-specific external-tool lifecycle. Agent and chat construct separate instances even when they select the same server configuration.
Implementations§
Source§impl ExternalToolRuntime
impl ExternalToolRuntime
pub fn from_config( config: &Config, mode: ExternalToolMode, capabilities: Vec<Capability>, ) -> Result<Self>
Sourcepub fn replay(
mode: ExternalToolMode,
entries: Vec<ToolEntry>,
results: BTreeMap<String, VecDeque<ExternalToolResult>>,
) -> Self
pub fn replay( mode: ExternalToolMode, entries: Vec<ToolEntry>, results: BTreeMap<String, VecDeque<ExternalToolResult>>, ) -> Self
Build a replay lifecycle from admitted entries and recorded results. It has no server configuration and therefore cannot reconnect.
Sourcepub fn set_client_services(&mut self, services: McpClientServices)
pub fn set_client_services(&mut self, services: McpClientServices)
Install product-owned handlers for authority-bearing server requests. Configured sampling or elicitation fails connection when its handler is absent, so capability advertisement can never outrun the product UI.
Sourcepub fn set_capabilities(&mut self, capabilities: Vec<Capability>)
pub fn set_capabilities(&mut self, capabilities: Vec<Capability>)
Replace the admission capabilities (the composition root supplies the session’s derived grant surface before discovery).
pub fn with_observer(self, observer: Arc<dyn ExternalToolObserver>) -> Self
pub fn server_ids(&self) -> Vec<&str>
pub fn state(&self, server_id: &str) -> Option<ExternalConnectionState>
pub fn admitted_entries(&self) -> Vec<ToolEntry>
pub fn admission_rejections( &self, server_id: &str, ) -> Vec<ExternalToolRejection>
Sourcepub fn drain_server_events(
&mut self,
server_id: &str,
) -> Result<Vec<McpServerEvent>>
pub fn drain_server_events( &mut self, server_id: &str, ) -> Result<Vec<McpServerEvent>>
Drain progress, logging, resource, catalog, task, and subscription notifications received since the previous call.
Sourcepub fn stderr_tail(&self, server_id: &str) -> Result<Vec<u8>>
pub fn stderr_tail(&self, server_id: &str) -> Result<Vec<u8>>
Captured rolling stderr tail for a stdio server.
Sourcepub async fn set_log_level(&self, server_id: &str, level: &str) -> Result<()>
pub async fn set_log_level(&self, server_id: &str, level: &str) -> Result<()>
Set a server’s MCP logging threshold when it advertises logging.
pub async fn discover_server( &mut self, server_id: &str, ) -> Result<Vec<ToolEntry>>
Sourcepub async fn refresh_server(
&mut self,
server_id: &str,
) -> Result<Vec<ToolEntry>>
pub async fn refresh_server( &mut self, server_id: &str, ) -> Result<Vec<ToolEntry>>
Re-list and re-admit one connected server’s catalog after an MCP list-change notification. Old bindings are removed before replacement, so a deleted remote tool can never remain callable.
Sourcepub async fn sync_server_events(
&mut self,
) -> Result<Vec<(String, McpServerEvent)>>
pub async fn sync_server_events( &mut self, ) -> Result<Vec<(String, McpServerEvent)>>
Drain notifications and refresh any changed tool catalogs. All events are returned to the product for display or durable recording.
pub async fn call( &mut self, namespaced_tool: &str, arguments: Value, ) -> Result<ExternalToolResult>
pub async fn shutdown(&mut self) -> Result<()>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ExternalToolRuntime
impl !RefUnwindSafe for ExternalToolRuntime
impl Send for ExternalToolRuntime
impl Sync for ExternalToolRuntime
impl Unpin for ExternalToolRuntime
impl UnsafeUnpin for ExternalToolRuntime
impl !UnwindSafe for ExternalToolRuntime
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.