pub struct McpTool { /* private fields */ }Expand description
A tool that proxies calls to an MCP server (McpTool).
McpClient::list_tools builds these. The tool is invoked under its server-side name, which
differs from name when the client sets a prefix.
Implementations§
Source§impl McpTool
impl McpTool
Sourcepub fn new(config: McpToolConfig) -> Self
pub fn new(config: McpToolConfig) -> Self
Creates a tool invoked on the server under config.name.
Sourcepub fn mcp_client(&self) -> &McpClient
pub fn mcp_client(&self) -> &McpClient
The MCP client this tool belongs to.
Sourcepub fn server_tool_name(&self) -> &str
pub fn server_tool_name(&self) -> &str
The name the server lists the tool under.
Trait Implementations§
Source§impl Tool for McpTool
impl Tool for McpTool
Source§fn description(&self) -> &str
fn description(&self) -> &str
What the tool does; it must match the spec’s description.
Source§fn tool_spec(&self) -> ToolSpec
fn tool_spec(&self) -> ToolSpec
The spec sent to the model: name, description and input schema.
Source§fn stream(&self, context: ToolContext) -> ToolStream
fn stream(&self, context: ToolContext) -> ToolStream
Runs the tool. The stream is
'static, so the agent can run it on its own task.Auto Trait Implementations§
impl !RefUnwindSafe for McpTool
impl !UnwindSafe for McpTool
impl Freeze for McpTool
impl Send for McpTool
impl Sync for McpTool
impl Unpin for McpTool
impl UnsafeUnpin for McpTool
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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 moreCreates a shared type from an unshared type.