Skip to main content

hematite/tools/
tool.rs

1use serde_json::Value;
2
3#[allow(dead_code)]
4pub trait HematiteTool {
5    fn name(&self) -> &'static str;
6    fn description(&self) -> &'static str;
7    fn risk_level(&self, args: &serde_json::Value) -> RiskLevel;
8
9    /// Estimates the context window impact before execution
10    fn estimate_token_cost(&self, args: &Value) -> usize;
11
12    /// Mandatory security intercept prior to any execution
13    fn security_audit(&self, args: &Value) -> Result<(), String>;
14
15    /// Executes the tool in a dry-run mode
16    fn dry_run(&self, args: Value) -> Result<String, String>;
17
18    /// Executes the tool for real, potentially hitting permission guards
19    fn run(&self, args: Value) -> Result<String, String>;
20}
21
22#[derive(Debug, Clone, Copy, PartialEq, Eq)]
23pub enum RiskLevel {
24    Safe,
25    Moderate,
26    High,
27}