Skip to main content

nuro_core/
tool.rs

1use crate::Result;
2use async_trait::async_trait;
3use serde_json::Value;
4
5#[derive(Debug, Default)]
6pub struct ToolContext {}
7
8impl ToolContext {
9    pub fn new() -> Self {
10        Self {}
11    }
12}
13
14#[derive(Debug, Clone)]
15pub struct ToolOutput {
16    pub content: Value,
17}
18
19impl ToolOutput {
20    pub fn new(content: Value) -> Self {
21        Self { content }
22    }
23}
24
25#[async_trait]
26pub trait Tool: Send + Sync {
27    fn name(&self) -> &str;
28    fn description(&self) -> &str;
29
30    async fn execute(&self, input: Value, ctx: &ToolContext) -> Result<ToolOutput>;
31}