pub struct TypedToolAdapter<T> { /* private fields */ }Expand description
Adapter that turns any TypedTool into a full Tool.
It gives the wrapped tool Name = DynamicToolName, deserializes the
model’s Value arguments into TypedTool::Input before dispatching, and
synthesises a structured validation-error ToolResult when that fails.
You rarely name this type directly — register a TypedTool with
ToolRegistry::register_typed, which wraps it for you. The adapter
pattern (rather than a blanket impl Tool for T: TypedTool) is required
for coherence: a blanket impl would conflict with the existing
SimpleToolAdapter impl, because the compiler cannot rule out a
downstream TypedTool impl for SimpleToolAdapter.
This adapter is also where the typed Input is threaded through the
erased-tool machinery without leaking the generic into trait objects: the
registry’s ErasedTool wrapper still only ever sees Value, while the
concrete Input type (and the deserialize) live here, inside the adapter’s
concrete T.
Implementations§
Source§impl<T> TypedToolAdapter<T>
impl<T> TypedToolAdapter<T>
Sourcepub const fn new(tool: T) -> TypedToolAdapter<T>
pub const fn new(tool: T) -> TypedToolAdapter<T>
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Unwrap the inner TypedTool.