use std::sync::Arc;
use adk_core::{ReadonlyContext, Result, Tool, Toolset};
use async_trait::async_trait;
use crate::tool::AcpAgentTool;
pub struct AcpToolset {
name: String,
agents: Vec<Arc<AcpAgentTool>>,
}
impl AcpToolset {
pub fn new(name: impl Into<String>) -> Self {
Self { name: name.into(), agents: Vec::new() }
}
pub fn with_agent(mut self, tool: AcpAgentTool) -> Self {
self.agents.push(Arc::new(tool));
self
}
}
#[async_trait]
impl Toolset for AcpToolset {
fn name(&self) -> &str {
&self.name
}
async fn tools(&self, _ctx: Arc<dyn ReadonlyContext>) -> Result<Vec<Arc<dyn Tool>>> {
Ok(self.agents.iter().map(|a| a.clone() as Arc<dyn Tool>).collect())
}
}