pub struct FunctionToolBuilder<A, R> { /* private fields */ }Expand description
Builder for FunctionTool.
Implementations§
Source§impl<A, R> FunctionToolBuilder<A, R>
impl<A, R> FunctionToolBuilder<A, R>
Sourcepub fn version(self, version: impl Into<String>) -> Self
pub fn version(self, version: impl Into<String>) -> Self
Sets an explicit semantic tool version. The default is v1.
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 input_schema(self, schema: Value) -> Self
pub fn input_schema(self, schema: Value) -> Self
Sets an explicit provider-safe input schema.
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 write_effect(self) -> Self
pub fn write_effect(self) -> Self
Marks the tool as write-like.
Sourcepub fn require_approval(self) -> Self
pub fn require_approval(self) -> Self
Requires host approval before core releases the executor.
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.
Source§impl FunctionToolBuilder<(), ()>
impl FunctionToolBuilder<(), ()>
Sourcepub fn executor<A, R, F>(self, handler: F) -> FunctionToolBuilder<A, R>
pub fn executor<A, R, F>(self, handler: F) -> FunctionToolBuilder<A, R>
Sets a typed executor that does not need execution context.
Sourcepub fn executor_with_context<A, R, F>(
self,
handler: F,
) -> FunctionToolBuilder<A, R>where
A: ToolArgs,
R: ToolOutput,
F: Fn(A, TypedToolContext) -> ToolResult<R> + Send + Sync + 'static,
pub fn executor_with_context<A, R, F>(
self,
handler: F,
) -> FunctionToolBuilder<A, R>where
A: ToolArgs,
R: ToolOutput,
F: Fn(A, TypedToolContext) -> ToolResult<R> + Send + Sync + 'static,
Sets a typed executor that receives the core execution context.
Source§impl<A, R> FunctionToolBuilder<A, R>where
A: ToolArgs,
R: ToolOutput,
impl<A, R> FunctionToolBuilder<A, R>where
A: ToolArgs,
R: ToolOutput,
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 FunctionToolBuilder<A, R>
impl<A, R> !UnwindSafe for FunctionToolBuilder<A, R>
impl<A, R> Freeze for FunctionToolBuilder<A, R>
impl<A, R> Send for FunctionToolBuilder<A, R>
impl<A, R> Sync for FunctionToolBuilder<A, R>
impl<A, R> Unpin for FunctionToolBuilder<A, R>
impl<A, R> UnsafeUnpin for FunctionToolBuilder<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