call_tool_with

Function call_tool_with 

Source
pub async fn call_tool_with<T: Serialize>(
    name: &str,
    args: &T,
) -> Result<FunctionResponse, ToolError>
Expand description

Call a tool by name with typed arguments.

This function provides a more ergonomic API for calling tools when you have typed arguments that can be serialized to JSON.

§Arguments

  • name - The name of the tool to call
  • args - Arguments that implement serde::Serialize

§Example

use tools_rs::call_tool_with;
use serde::Serialize;

#[derive(Serialize)]
struct AddArgs { a: i32, b: i32 }

let result = call_tool_with("add", &AddArgs { a: 1, b: 2 }).await?;