use serde::Deserialize;
use super::{
super::{EmptyParams, definition_of},
*,
};
use crate::llm_tool;
fn test_ctx() -> ToolContext {
ToolContext::new()
}
#[derive(Deserialize, schemars::JsonSchema)]
struct PathParams {
path: String,
}
struct SampleTool;
impl RustTool for SampleTool {
type Params = PathParams;
const NAME: &'static str = "sample";
const DESCRIPTION: &'static str = "A sample tool";
#[allow(unknown_lints)]
#[expect(clippy::unused_async_trait_impl)]
async fn call(
&self,
params: Self::Params,
_ctx: &ToolContext,
) -> Result<ToolOutput, ToolError> {
Ok(params.path.into())
}
}
#[derive(Deserialize, schemars::JsonSchema)]
struct RunCommandParams {
command: String,
#[serde(default)]
timeout: Option<i64>,
#[serde(default)]
env: Option<std::collections::HashMap<String, String>>,
}
struct RunCommandTool;
impl RustTool for RunCommandTool {
type Params = RunCommandParams;
const NAME: &'static str = "run_command";
const DESCRIPTION: &'static str = "Runs a command.";
#[allow(unknown_lints)]
#[expect(clippy::unused_async_trait_impl)]
async fn call(
&self,
params: Self::Params,
_ctx: &ToolContext,
) -> Result<ToolOutput, ToolError> {
assert!(params.timeout.is_none());
assert!(params.env.is_none());
Ok(format!("Ran: {}", params.command).into())
}
}
mod basic;
mod macros;