use crate::error::BrightDataError;
use crate::tool::ToolResolver;
use serde_json::Value;
pub struct RpcClient;
impl RpcClient {
pub async fn call_tool(tool_name: &str, parameters: Value) -> Result<Value, BrightDataError> {
let resolver = ToolResolver::default();
match resolver.resolve(tool_name) {
Some(tool) => {
tool.execute_legacy(parameters).await
},
None => Err(BrightDataError::ToolError(format!(
"Unknown tool: {}",
tool_name
)))
}
}
pub fn list_available_tools() -> Vec<&'static str> {
ToolResolver::default().get_available_tool_names()
}
}