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>
impl<A: ToolArgs, R: ToolOutput> TypedToolBuilder<A, R>
Sourcepub fn policy_ref(self, policy_ref: PolicyRef) -> Self
pub fn policy_ref(self, policy_ref: PolicyRef) -> Self
Sets an explicit policy ref.
Sourcepub fn description(self, description: impl Into<String>) -> Self
pub fn description(self, description: impl Into<String>) -> Self
Sets a provider-visible description.
Sourcepub fn description_opt(self, description: Option<String>) -> Self
pub fn description_opt(self, description: Option<String>) -> Self
Sets provider-visible description metadata when present.
Sourcepub fn input_schema(self, schema: Value) -> Self
pub fn input_schema(self, schema: Value) -> Self
Sets an explicit provider-safe input schema.
Sourcepub fn write_effect(self) -> Self
pub fn write_effect(self) -> Self
Marks the tool as write-like.
Sourcepub fn effect(self, effect_class: EffectClass, risk_class: RiskClass) -> Self
pub fn effect(self, effect_class: EffectClass, risk_class: RiskClass) -> Self
Sets explicit effect and risk classes.
Sourcepub fn required_permission(self, permission: CapabilityPermission) -> Self
pub fn required_permission(self, permission: CapabilityPermission) -> Self
Adds a required permission.
Sourcepub fn timeout_ms(self, timeout_ms: u64) -> Self
pub fn timeout_ms(self, timeout_ms: u64) -> Self
Sets execution timeout metadata.
Sourcepub fn sync_handler<F>(self, handler: F) -> Self
pub fn sync_handler<F>(self, handler: F) -> Self
Sets the sync handler.
Sourcepub fn async_handler<F, Fut, Runner>(
self,
runner: Arc<Runner>,
handler: F,
) -> Selfwhere
F: Fn(A, TypedToolContext) -> Fut + Send + Sync + 'static,
Fut: Future<Output = ToolResult<R>> + Send + 'static,
Runner: AsyncToolRunner + 'static,
pub fn async_handler<F, Fut, Runner>(
self,
runner: Arc<Runner>,
handler: F,
) -> Selfwhere
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.
Sourcepub fn build(self) -> Result<TypedTool<A, R>, AgentError>
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> 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