Skip to main content

DiscoverTool

Struct DiscoverTool 

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

A Tool that exposes only discover and help builtins for runtime schema discovery. Returned by ScriptingToolSet::tools in DiscoveryMode::WithDiscovery mode alongside the main script tool.

The LLM uses this tool to explore available commands before writing scripts for the main tool.

use bashkit::Tool;
use bashkit_scripted_tool::{ScriptingToolSet, ToolArgs, ToolDef};

let toolset = ScriptingToolSet::builder("api")
    .tool_fn(
        ToolDef::new("greet", "Greet someone").with_category("social"),
        |_args: &ToolArgs| Ok("hello\n".to_string()),
    )
    .with_discovery()
    .build();

let tools = toolset.tools();
assert_eq!(tools.len(), 2);

// Second tool is the DiscoverTool
let discover = &tools[1];
assert!(discover.name().ends_with("_discover"));

Trait Implementations§

Source§

impl Tool for DiscoverTool

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> 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, 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.