snm_brightdata_client/
rpc_client.rs1use crate::error::BrightDataError;
3use crate::tool::ToolResolver;
4use serde_json::Value;
5
6pub struct RpcClient;
7
8impl RpcClient {
9 pub async fn call_tool(tool_name: &str, parameters: Value) -> Result<Value, BrightDataError> {
11 let resolver = ToolResolver::default();
12
13 match resolver.resolve(tool_name) {
14 Some(tool) => {
15 tool.execute_legacy(parameters).await
17 },
18 None => Err(BrightDataError::ToolError(format!(
19 "Unknown tool: {}",
20 tool_name
21 )))
22 }
23 }
24
25 pub fn list_available_tools() -> Vec<&'static str> {
27 ToolResolver::default().get_available_tool_names()
28 }
29}