Skip to main content

ProgressiveToolView

Struct ProgressiveToolView 

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

Token-efficient tool view that progressively reveals tool schemas.

Only activated tools have their full JSON Schema included in LLM requests. Inactive tools appear only as compact name + description entries in the system prompt.

Implementations§

Source§

impl ProgressiveToolView

Source

pub fn new(tools: Vec<ToolDescriptor>) -> Self

Create a new progressive view from the full tool list.

All tools start as inactive (compact view only).

Source

pub fn activate(&mut self, tool_id: &str)

Activate a specific tool by ID (its full schema will be sent).

Source

pub fn activate_hints(&mut self, text: &str)

Scan LLM output text for $tool_name hints and activate mentioned tools.

This allows the LLM to signal interest in a tool before actually calling it, so the full schema is available on the next turn.

Source

pub fn is_activated(&self, tool_id: &str) -> bool

Returns true if the given tool has been activated.

Source

pub fn activated_count(&self) -> usize

Returns the number of currently activated tools.

Source

pub fn total_count(&self) -> usize

Returns the total number of tools in the view.

Source

pub fn summary_prompt(&self) -> String

Returns a compact summary prompt listing all tools by name and description, suitable for injection into the system prompt.

Returns an empty string when no tools are available.

Source

pub fn activated_tools(&self) -> Vec<ToolDescriptor>

Returns full descriptors for activated tools only.

These are the tools whose complete JSON Schema should be sent to the LLM (either in the prompt or via native tool calling API).

Source

pub fn all_tools(&self) -> &[ToolDescriptor]

Returns all tool descriptors regardless of activation state.

Trait Implementations§

Source§

impl Debug for ProgressiveToolView

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