Skip to main content

TypedToolBuilder

Struct TypedToolBuilder 

Source
pub struct TypedToolBuilder<A: ToolArgs, R: ToolOutput> { /* private fields */ }
Expand description

Builder for a typed tool.

Implementations§

Source§

impl<A: ToolArgs, R: ToolOutput> TypedToolBuilder<A, R>

Source

pub fn policy_ref(self, policy_ref: PolicyRef) -> Self

Sets an explicit policy ref.

Source

pub fn description(self, description: impl Into<String>) -> Self

Sets a provider-visible description.

Source

pub fn description_opt(self, description: Option<String>) -> Self

Sets provider-visible description metadata when present.

Source

pub fn input_schema(self, schema: Value) -> Self

Sets an explicit provider-safe input schema.

Source

pub fn read_only(self) -> Self

Marks the tool read-only.

Source

pub fn write_effect(self) -> Self

Marks the tool as write-like.

Source

pub fn effect(self, effect_class: EffectClass, risk_class: RiskClass) -> Self

Sets explicit effect and risk classes.

Source

pub fn required_permission(self, permission: CapabilityPermission) -> Self

Adds a required permission.

Source

pub fn timeout_ms(self, timeout_ms: u64) -> Self

Sets execution timeout metadata.

Source

pub fn sync_handler<F>(self, handler: F) -> Self
where F: Fn(A, TypedToolContext) -> ToolResult<R> + Send + Sync + 'static,

Sets the sync handler.

Source

pub fn async_handler<F, Fut, Runner>( self, runner: Arc<Runner>, handler: F, ) -> Self
where F: Fn(A, TypedToolContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = ToolResult<R>> + Send + 'static, Runner: AsyncToolRunner + 'static,

Sets an async handler through a host-owned runner.

Source

pub fn build(self) -> Result<TypedTool<A, R>, AgentError>

Builds the typed tool declaration and executor adapter.

Auto Trait Implementations§

§

impl<A, R> !RefUnwindSafe for TypedToolBuilder<A, R>

§

impl<A, R> !UnwindSafe for TypedToolBuilder<A, R>

§

impl<A, R> Freeze for TypedToolBuilder<A, R>

§

impl<A, R> Send for TypedToolBuilder<A, R>

§

impl<A, R> Sync for TypedToolBuilder<A, R>

§

impl<A, R> Unpin for TypedToolBuilder<A, R>

§

impl<A, R> UnsafeUnpin for TypedToolBuilder<A, R>

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

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V