File size: 520 Bytes
d90101d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | use std::sync::Arc;
use forge_app::McpClientInfra;
use forge_app::domain::{ToolName, ToolOutput};
#[derive(Clone)]
pub struct McpExecutor<T> {
pub client: Arc<T>,
pub tool_name: ToolName,
}
impl<T: McpClientInfra> McpExecutor<T> {
pub fn new(tool_name: ToolName, client: Arc<T>) -> anyhow::Result<Self> {
Ok(Self { client, tool_name })
}
pub async fn call_tool(&self, input: serde_json::Value) -> anyhow::Result<ToolOutput> {
self.client.call(&self.tool_name, input).await
}
}
|