pub struct Catalog { /* private fields */ }Expand description
The validated tool registry built during agent creation.
Implementations§
Source§impl Catalog
impl Catalog
Sourcepub fn register(&mut self, tool: Arc<dyn Tool>) -> Result<()>
pub fn register(&mut self, tool: Arc<dyn Tool>) -> Result<()>
Registers one tool and rejects invalid definitions or duplicate names.
§Errors
Returns an error if validation or an operation required by this function fails.
Sourcepub fn finalize(&mut self) -> Result<()>
pub fn finalize(&mut self) -> Result<()>
Freezes the registry after all tool owners have registered their handlers.
§Errors
Returns an error if validation or an operation required by this function fails.
Sourcepub fn registered_definitions(&self) -> Arc<[Arc<ToolDefinition>]> ⓘ
pub fn registered_definitions(&self) -> Arc<[Arc<ToolDefinition>]> ⓘ
Returns all registered definitions in stable name order.
Sourcepub fn direct_definitions(&self) -> Arc<[Arc<ToolDefinition>]> ⓘ
pub fn direct_definitions(&self) -> Arc<[Arc<ToolDefinition>]> ⓘ
Returns definitions included in every model request in stable name order.
Sourcepub fn deferred_definitions(&self) -> Arc<[Arc<ToolDefinition>]> ⓘ
pub fn deferred_definitions(&self) -> Arc<[Arc<ToolDefinition>]> ⓘ
Returns discoverable definitions in stable name order.
Sourcepub fn revision(&self) -> Result<&str>
pub fn revision(&self) -> Result<&str>
Returns the stable schema and exposure fingerprint of this finalized catalog.
§Errors
Returns an error if validation or an operation required by this function fails.
Sourcepub fn search_deferred(
&self,
query: &str,
searchable: &BTreeSet<String>,
) -> Result<Vec<Arc<ToolDefinition>>>
pub fn search_deferred( &self, query: &str, searchable: &BTreeSet<String>, ) -> Result<Vec<Arc<ToolDefinition>>>
Searches currently deferred tools using BM25 relevance ranking.
§Errors
Returns an error if validation or an operation required by this function fails.
Sourcepub fn bind_call(
&self,
call: ToolCall,
materialized: &BTreeSet<String>,
searchable: &BTreeSet<String>,
) -> Result<BoundToolCall>
pub fn bind_call( &self, call: ToolCall, materialized: &BTreeSet<String>, searchable: &BTreeSet<String>, ) -> Result<BoundToolCall>
Validates a model-returned call against this catalog and its step materialization.
§Errors
Returns an error if validation or an operation required by this function fails.
Sourcepub fn requires_approval(&self, name: &str) -> bool
pub fn requires_approval(&self, name: &str) -> bool
Returns whether the named tool requires approval.
Sourcepub fn is_read_only(&self, name: &str) -> bool
pub fn is_read_only(&self, name: &str) -> bool
Returns whether the named tool declares itself read-only.