Skip to main content

AliasedTool

Struct AliasedTool 

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

A tool wrapper that exposes a different name while delegating behavior to an inner tool.

This is useful when importing tools from external systems (e.g. MCP servers) where the upstream tool names are not stable or do not match the caller’s desired naming scheme.

Implementations§

Source§

impl AliasedTool

Source

pub fn new(alias: impl Into<String>, inner: Arc<dyn ToolDyn>) -> Self

Create a new aliased tool wrapper.

Source

pub fn inner(&self) -> &Arc<dyn ToolDyn>

Access the wrapped tool.

Trait Implementations§

Source§

impl ToolDyn for AliasedTool

Source§

fn name(&self) -> &str

The tool’s unique name.
Source§

fn description(&self) -> &str

Human-readable description of what the tool does.
Source§

fn input_schema(&self) -> Value

JSON Schema for the tool’s input parameters.
Source§

fn call( &self, input: Value, ) -> Pin<Box<dyn Future<Output = Result<Value, ToolError>> + Send + '_>>

Execute the tool with the given input.
Source§

fn concurrency_hint(&self) -> ToolConcurrencyHint

Optional concurrency hint used by planners/deciders. Read more
Source§

fn maybe_streaming(&self) -> Option<&dyn ToolDynStreaming>

If this tool also supports streaming, return a reference to its streaming interface. Default is None; streaming is opt-in and non-disruptive.

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<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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.