Skip to main content

ToolBuilder

Struct ToolBuilder 

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

Builder for ergonomic toolkit tool declarations. The builder requires an explicit effect and risk class before it can produce a Tool or AsyncTool.

Implementations§

Source§

impl ToolBuilder

Source

pub fn new( tool_name: impl Into<String>, executor_ref: impl Into<String>, schema_id: impl Into<String>, policy_ref: PolicyRef, ) -> Self

Creates a new data-only tool declaration builder.

Source

pub fn read_only(self) -> Self

Marks this declaration as a read-like tool.

Source

pub fn write_effect(self) -> Self

Marks this declaration as a write-like tool.

Source

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

Sets an explicit effect and risk class.

Source

pub fn capability_id(self, capability_id: CapabilityId) -> Self

Sets the stable capability id used by the runtime package.

Source

pub fn namespace(self, namespace: CapabilityNamespace) -> Self

Sets the capability namespace.

Source

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

Adds a required permission to the provider-visible tool snapshot.

Source

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

Attaches a provider-safe JSON schema body to this tool declaration.

Source

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

Attaches a bounded provider-visible description to this declaration.

Source

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

Attaches a provider-visible description when one is present.

Source

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

Adds another policy ref that must travel with the tool declaration.

Source

pub fn require_approval(self) -> Self

Requires host approval before the core runtime releases the executor.

Source

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

Sets the redaction policy ref for tool results.

Source

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

Sets the execution timeout metadata.

Source

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

Sets the cancellation metadata.

Source

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

Sets the reconciliation metadata.

Source

pub fn privacy(self, privacy: PrivacyClass) -> Self

Sets the privacy class used for the tool snapshot and route.

Source

pub fn async_mode(self) -> Self

Marks the declaration as async metadata.

Source

pub fn build(self) -> Result<Tool, AgentError>

Builds a synchronous tool declaration.

Source

pub fn build_async(self) -> Result<AsyncTool, AgentError>

Builds an async tool declaration.

Trait Implementations§

Source§

impl Clone for ToolBuilder

Source§

fn clone(&self) -> ToolBuilder

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ToolBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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