use std::sync::Arc;
use lingshu_tools::registry::{ToolContext, ToolHandler, ToolRegistry};
use lingshu_types::ToolSchema;
pub struct SdkToolRegistry {
inner: ToolRegistry,
}
impl SdkToolRegistry {
pub fn new() -> Self {
Self {
inner: ToolRegistry::new(),
}
}
pub fn register(&mut self, handler: Box<dyn ToolHandler>) {
self.inner.register_dynamic(handler);
}
pub fn tool_names(&self) -> Vec<&str> {
self.inner.tool_names()
}
pub fn toolset_names(&self) -> Vec<&str> {
self.inner.toolset_names()
}
pub fn tools_in_toolset(&self, toolset: &str) -> Vec<&str> {
self.inner.tools_in_toolset(toolset)
}
pub fn toolset_summary(&self) -> Vec<(String, usize)> {
self.inner.toolset_summary()
}
pub fn get_definitions(
&self,
enabled: Option<&[String]>,
disabled: Option<&[String]>,
ctx: &ToolContext,
) -> Vec<ToolSchema> {
self.inner.get_definitions(enabled, disabled, ctx)
}
pub fn into_inner(self) -> ToolRegistry {
self.inner
}
pub fn as_inner(&self) -> &ToolRegistry {
&self.inner
}
pub fn into_arc(self) -> Arc<ToolRegistry> {
Arc::new(self.inner)
}
}
impl Default for SdkToolRegistry {
fn default() -> Self {
Self::new()
}
}
impl From<ToolRegistry> for SdkToolRegistry {
fn from(inner: ToolRegistry) -> Self {
Self { inner }
}
}
pub use lingshu_tools::registry::{ToolContext as SdkToolContext, ToolHandler as SdkToolHandler};