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
impl ToolBuilder
Sourcepub fn new(
tool_name: impl Into<String>,
executor_ref: impl Into<String>,
schema_id: impl Into<String>,
policy_ref: PolicyRef,
) -> Self
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.
Sourcepub fn write_effect(self) -> Self
pub fn write_effect(self) -> Self
Marks this declaration as a write-like tool.
Sourcepub fn effect(self, effect_class: EffectClass, risk_class: RiskClass) -> Self
pub fn effect(self, effect_class: EffectClass, risk_class: RiskClass) -> Self
Sets an explicit effect and risk class.
Sourcepub fn capability_id(self, capability_id: CapabilityId) -> Self
pub fn capability_id(self, capability_id: CapabilityId) -> Self
Sets the stable capability id used by the runtime package.
Sourcepub fn namespace(self, namespace: CapabilityNamespace) -> Self
pub fn namespace(self, namespace: CapabilityNamespace) -> Self
Sets the capability namespace.
Sourcepub fn required_permission(self, permission: CapabilityPermission) -> Self
pub fn required_permission(self, permission: CapabilityPermission) -> Self
Adds a required permission to the provider-visible tool snapshot.
Sourcepub fn redacted_schema(self, schema: Value) -> Self
pub fn redacted_schema(self, schema: Value) -> Self
Attaches a provider-safe JSON schema body to this tool declaration.
Sourcepub fn description(self, description: impl Into<String>) -> Self
pub fn description(self, description: impl Into<String>) -> Self
Attaches a bounded provider-visible description to this declaration.
Sourcepub fn description_opt(self, description: Option<String>) -> Self
pub fn description_opt(self, description: Option<String>) -> Self
Attaches a provider-visible description when one is present.
Sourcepub fn policy_ref(self, policy_ref: PolicyRef) -> Self
pub fn policy_ref(self, policy_ref: PolicyRef) -> Self
Adds another policy ref that must travel with the tool declaration.
Sourcepub fn require_approval(self) -> Self
pub fn require_approval(self) -> Self
Requires host approval before the core runtime releases the executor.
Sourcepub fn redaction_policy(self, policy_ref: PolicyRef) -> Self
pub fn redaction_policy(self, policy_ref: PolicyRef) -> Self
Sets the redaction policy ref for tool results.
Sourcepub fn timeout_ms(self, timeout_ms: u64) -> Self
pub fn timeout_ms(self, timeout_ms: u64) -> Self
Sets the execution timeout metadata.
Sourcepub fn cancellation(self, cancellation: impl Into<String>) -> Self
pub fn cancellation(self, cancellation: impl Into<String>) -> Self
Sets the cancellation metadata.
Sourcepub fn reconciliation(self, reconciliation: impl Into<String>) -> Self
pub fn reconciliation(self, reconciliation: impl Into<String>) -> Self
Sets the reconciliation metadata.
Sourcepub fn privacy(self, privacy: PrivacyClass) -> Self
pub fn privacy(self, privacy: PrivacyClass) -> Self
Sets the privacy class used for the tool snapshot and route.
Sourcepub fn async_mode(self) -> Self
pub fn async_mode(self) -> Self
Marks the declaration as async metadata.
Sourcepub fn build(self) -> Result<Tool, AgentError>
pub fn build(self) -> Result<Tool, AgentError>
Builds a synchronous tool declaration.
Sourcepub fn build_async(self) -> Result<AsyncTool, AgentError>
pub fn build_async(self) -> Result<AsyncTool, AgentError>
Builds an async tool declaration.
Trait Implementations§
Source§impl Clone for ToolBuilder
impl Clone for ToolBuilder
Source§fn clone(&self) -> ToolBuilder
fn clone(&self) -> ToolBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more