Skip to main content

ScriptedTool

Struct ScriptedTool 

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

A Tool that orchestrates multiple tools via bash scripts.

Each registered tool (defined by ToolDef + callback) becomes a bash builtin. The LLM sends a bash script that can pipe, loop, branch, and compose these builtins together with standard utilities like jq, grep, sed, etc.

Arguments are passed as --key value flags and parsed into typed JSON per the tool’s input_schema.

Reusable — execute() can be called multiple times. Each call gets a fresh Bash interpreter with the same set of tool builtins.

Create via ScriptedTool::builder.

Implementations§

Source§

impl ScriptedTool

Source

pub fn builder(name: impl Into<String>) -> ScriptedToolBuilder

Create a builder with the given tool name.

Source

pub fn take_last_execution_trace(&self) -> Option<ScriptedExecutionTrace>

Return and clear the trace from the most recent execute call.

Trait Implementations§

Source§

impl Clone for ScriptedTool

Source§

fn clone(&self) -> Self

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 Tool for ScriptedTool

Source§

fn name(&self) -> &str

Tool identifier (e.g., “bashkit”, “calculator”)
Source§

fn display_name(&self) -> &str

Human-readable display name for UI.
Source§

fn short_description(&self) -> &str

One-line description for tool listings
Source§

fn description(&self) -> &str

Token-efficient description for LLMs.
Source§

fn help(&self) -> String

Full documentation for LLMs (markdown, with examples)
Source§

fn system_prompt(&self) -> String

Condensed description for system prompts (token-efficient)
Source§

fn locale(&self) -> &str

Locale used for user-facing text.
Source§

fn input_schema(&self) -> Value

JSON Schema for input validation
Source§

fn output_schema(&self) -> Value

JSON Schema for output structure
Source§

fn version(&self) -> &str

Library/tool version
Source§

fn execution(&self, args: Value) -> Result<ToolExecution, ToolError>

Create a single-use execution.
Source§

fn execute<'life0, 'async_trait>( &'life0 self, req: ToolRequest, ) -> Pin<Box<dyn Future<Output = ToolResponse> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Execute the tool
Source§

fn execute_with_status<'life0, 'async_trait>( &'life0 self, req: ToolRequest, status_callback: Box<dyn FnMut(ToolStatus) + Send>, ) -> Pin<Box<dyn Future<Output = ToolResponse> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Execute with status callbacks for progress tracking

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.