pub struct ToolRegistry { /* private fields */ }Expand description
Registry for built-in, provider, alias, and localized tool lookup.
Implementations§
Source§impl ToolRegistry
impl ToolRegistry
Sourcepub fn register(&mut self, tool: Arc<dyn Tool>) -> Result<(), ToolError>
pub fn register(&mut self, tool: Arc<dyn Tool>) -> Result<(), ToolError>
Registers a built-in or custom tool by canonical ID.
pub fn get(&self, id_or_alias: &str) -> Option<Arc<dyn Tool>>
Sourcepub fn canonical_id(&self, id_or_alias: &str) -> Option<String>
pub fn canonical_id(&self, id_or_alias: &str) -> Option<String>
Resolves any accepted name to a canonical tool ID.
Sourcepub fn safety_metadata(&self, id_or_alias: &str) -> Option<ToolSafetyMetadata>
pub fn safety_metadata(&self, id_or_alias: &str) -> Option<ToolSafetyMetadata>
Resolves safety metadata for a registered tool.
Sourcepub fn question_handler_slot(&self) -> QuestionHandlerSlot
pub fn question_handler_slot(&self) -> QuestionHandlerSlot
Returns the shared question handler slot for host-bound tools.
Sourcepub fn set_question_handler(&self, handler: Option<Arc<dyn QuestionHandler>>)
pub fn set_question_handler(&self, handler: Option<Arc<dyn QuestionHandler>>)
Installs or clears the question handler used by ask_user.
Sourcepub fn diagnostics_provider_slot(&self) -> DiagnosticsProviderSlot
pub fn diagnostics_provider_slot(&self) -> DiagnosticsProviderSlot
Returns the shared diagnostics provider slot for host-bound tools.
Sourcepub fn set_diagnostics_provider(&self, provider: Arc<dyn DiagnosticsProvider>)
pub fn set_diagnostics_provider(&self, provider: Arc<dyn DiagnosticsProvider>)
Installs the diagnostics provider used by diagnostics.
Sourcepub fn diagnostics_available(&self) -> bool
pub fn diagnostics_available(&self) -> bool
Returns whether the diagnostics provider can serve requests now.
Sourcepub fn command_runner_slot(&self) -> CommandRunnerSlot
pub fn command_runner_slot(&self) -> CommandRunnerSlot
Returns the shared command runner slot for host-bound tools.
Sourcepub fn set_command_runner(&self, runner: Arc<dyn CommandRunner>)
pub fn set_command_runner(&self, runner: Arc<dyn CommandRunner>)
Installs the command runner used by command.
Sourcepub fn command_runner_available(&self) -> bool
pub fn command_runner_available(&self) -> bool
Returns whether the command runner can serve requests now.
Sourcepub fn file_version_store(&self) -> FileVersionStore
pub fn file_version_store(&self) -> FileVersionStore
Returns the session-local file version store shared with file tools.
Sourcepub fn todo_store(&self) -> TodoStore
pub fn todo_store(&self) -> TodoStore
Returns the session-local todo store shared with todo.
Sourcepub fn web_fetch_extractor_slot(
&self,
) -> Arc<RwLock<Option<Arc<dyn LLMProvider>>>> ⓘ
pub fn web_fetch_extractor_slot( &self, ) -> Arc<RwLock<Option<Arc<dyn LLMProvider>>>> ⓘ
Returns the shared web-fetch extractor slot.
Sourcepub fn set_web_fetch_extractor(&self, extractor: Option<Arc<dyn LLMProvider>>)
pub fn set_web_fetch_extractor(&self, extractor: Option<Arc<dyn LLMProvider>>)
Installs or clears the LLM used for web_fetch prompt extraction.
Sourcepub fn web_search_provider_slot(&self) -> WebSearchProviderSlot
pub fn web_search_provider_slot(&self) -> WebSearchProviderSlot
Returns the shared provider slot for web_search.
Sourcepub fn set_web_search_provider(&self, provider: Arc<dyn WebSearchProvider>)
pub fn set_web_search_provider(&self, provider: Arc<dyn WebSearchProvider>)
Installs the provider used by web_search.
Sourcepub fn web_search_available(&self) -> bool
pub fn web_search_available(&self) -> bool
Returns whether the web search provider can serve requests now.
Sourcepub fn resolve(&self, id_or_alias: &str) -> Option<ResolvedTool>
pub fn resolve(&self, id_or_alias: &str) -> Option<ResolvedTool>
Resolves IDs, display names, and aliases to one canonical tool.
pub fn list_ids(&self) -> Vec<String>
pub fn list_infos(&self) -> Vec<ToolInfo>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn map_tools<F>(&self, f: F) -> ToolRegistry
pub async fn register_provider( &self, provider: Arc<dyn ToolProvider>, ) -> Result<(), ToolError>
pub fn unregister_provider(&self, provider_id: &str) -> bool
pub fn set_tool_aliases(&self, tool_id: &str, aliases: ToolAliases)
pub fn get_by_alias(&self, alias: &str, lang: &str) -> Option<Arc<dyn Tool>>
pub fn list_providers(&self) -> Vec<String>
pub async fn provider_health(&self, provider_id: &str) -> Option<ProviderHealth>
pub async fn refresh_provider( &self, provider_id: &str, ) -> Result<(), ToolProviderError>
pub fn generate_tools_prompt(&self) -> String
pub fn generate_tools_prompt_with_parallel(&self, parallel: bool) -> String
pub fn generate_tools_prompt_with_lang( &self, language: Option<&str>, parallel: bool, ) -> String
pub fn generate_filtered_prompt(&self, tool_ids: &[String]) -> String
pub fn generate_filtered_prompt_with_parallel( &self, tool_ids: &[String], parallel: bool, ) -> String
Sourcepub fn generate_scoped_prompt_with_parallel(
&self,
tool_ids: &[String],
parallel: bool,
) -> String
pub fn generate_scoped_prompt_with_parallel( &self, tool_ids: &[String], parallel: bool, ) -> String
Generates a prompt for an explicit tool scope.
pub fn generate_scoped_prompt_with_lang( &self, tool_ids: &[String], language: Option<&str>, parallel: bool, ) -> String
pub fn generate_filtered_prompt_with_lang( &self, tool_ids: &[String], language: Option<&str>, parallel: bool, ) -> String
Sourcepub fn generate_scoped_prompt_with_mode(
&self,
tool_ids: &[impl AsRef<str>],
language: Option<&str>,
parallel: bool,
mode: ToolSchemaPromptMode,
) -> String
pub fn generate_scoped_prompt_with_mode( &self, tool_ids: &[impl AsRef<str>], language: Option<&str>, parallel: bool, mode: ToolSchemaPromptMode, ) -> String
Generate a scoped prompt with a configurable schema rendering mode.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ToolRegistry
impl !RefUnwindSafe for ToolRegistry
impl !UnwindSafe for ToolRegistry
impl Send for ToolRegistry
impl Sync for ToolRegistry
impl Unpin for ToolRegistry
impl UnsafeUnpin 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