pub struct ToolRegistry { /* private fields */ }Expand description
Registry for managing tools with tiered visibility.
All tools are always executable. Tier controls which definitions are sent to the LLM to save prompt tokens on simple tasks.
Implementations§
Source§impl ToolRegistry
impl ToolRegistry
Sourcepub fn with_defaults(workspace_root: PathBuf) -> Self
pub fn with_defaults(workspace_root: PathBuf) -> Self
Create a registry with all default tools, assigned to tiers.
Core (always in LLM prompt): bash, read/write/edit, ast_grep, glob/grep Standard (in prompt by default): git, agents Extended (in prompt after first use): ripgrep, fd, sd, erd, mise, zoxide
Sourcepub fn register_with_tier(&mut self, tool: Arc<dyn Tool>, tier: ToolTier)
pub fn register_with_tier(&mut self, tool: Arc<dyn Tool>, tier: ToolTier)
Register a tool at a specific tier
Sourcepub fn get_definitions(&self) -> Vec<ToolDefinition>
pub fn get_definitions(&self) -> Vec<ToolDefinition>
Get tool definitions visible to the LLM (Core + Standard + activated Extended). Extended tools become visible after first use or explicit activation.
Sourcepub fn select_for_query(
&self,
query: &str,
max_tools: usize,
) -> Vec<ToolDefinition>
pub fn select_for_query( &self, query: &str, max_tools: usize, ) -> Vec<ToolDefinition>
Dynamic tool selection — pick the most relevant tools for a given query.
Returns Core tools (always) + top-K scored Standard/Extended tools based on keyword matching between the query and tool names/descriptions. This reduces 22+ tools to ~8-10, making MCP and extended tools visible.
Sourcepub fn get_all_definitions(&self) -> Vec<ToolDefinition>
pub fn get_all_definitions(&self) -> Vec<ToolDefinition>
Get ALL tool definitions regardless of tier (for tests and introspection)
Sourcepub fn tool_names(&self) -> Vec<&str>
pub fn tool_names(&self) -> Vec<&str>
Get tool names
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ToolRegistry
impl !RefUnwindSafe for ToolRegistry
impl Send for ToolRegistry
impl Sync for ToolRegistry
impl Unpin for ToolRegistry
impl UnsafeUnpin for ToolRegistry
impl !UnwindSafe for ToolRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more