pub struct McpToolbox { /* private fields */ }
Available on crate feature
mcp
only.Expand description
Connects to an MCP server and provides tools at runtime to the agent.
WARN: The rmcp has a quirky feature to serve from ()
. This does not work; serve from
ClientInfo
instead, or from the transport and Swiftide
will handle the rest.
Implementations§
Source§impl McpToolbox
impl McpToolbox
Sourcepub fn with_blacklist<ITEM: Into<String>, I: IntoIterator<Item = ITEM>>(
&mut self,
blacklist: I,
) -> &mut Self
pub fn with_blacklist<ITEM: Into<String>, I: IntoIterator<Item = ITEM>>( &mut self, blacklist: I, ) -> &mut Self
Blacklist tools by name, the agent will not be able to use these tools
Sourcepub fn with_whitelist<ITEM: Into<String>, I: IntoIterator<Item = ITEM>>(
&mut self,
blacklist: I,
) -> &mut Self
pub fn with_whitelist<ITEM: Into<String>, I: IntoIterator<Item = ITEM>>( &mut self, blacklist: I, ) -> &mut Self
Whitelist tools by name, the agent will only be able to use these tools
Sourcepub fn with_filter(&mut self, filter: ToolFilter) -> &mut Self
pub fn with_filter(&mut self, filter: ToolFilter) -> &mut Self
Apply a custom filter to the tools
Sourcepub fn with_name(&mut self, name: impl Into<String>) -> &mut Self
pub fn with_name(&mut self, name: impl Into<String>) -> &mut Self
Apply an optional name to the toolbox
pub fn name(&self) -> &str
Sourcepub async fn try_from_transport<E: Error + From<Error> + Send + Sync + 'static, A>(
transport: impl IntoTransport<RoleClient, E, A>,
) -> Result<Self>
pub async fn try_from_transport<E: Error + From<Error> + Send + Sync + 'static, A>( transport: impl IntoTransport<RoleClient, E, A>, ) -> Result<Self>
Sourcepub fn from_running_service(
service: RunningService<RoleClient, InitializeRequestParam>,
) -> Self
pub fn from_running_service( service: RunningService<RoleClient, InitializeRequestParam>, ) -> Self
Create a new toolbox from a running service
Trait Implementations§
Source§impl Clone for McpToolbox
impl Clone for McpToolbox
Source§fn clone(&self) -> McpToolbox
fn clone(&self) -> McpToolbox
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl ToolBox for McpToolbox
impl ToolBox for McpToolbox
fn available_tools<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Box<dyn Tool>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn name(&self) -> Cow<'_, str>
fn boxed<'a>(self) -> Box<dyn ToolBox + 'a>where
Self: Sized + 'a,
Auto Trait Implementations§
impl Freeze for McpToolbox
impl !RefUnwindSafe for McpToolbox
impl Send for McpToolbox
impl Sync for McpToolbox
impl Unpin for McpToolbox
impl !UnwindSafe for McpToolbox
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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 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>
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