| 687 | |
| 688 | #[async_trait] |
| 689 | pub trait Tool: Send + Sync { |
| 690 | fn id(&self) -> &str; |
| 691 | fn description(&self) -> &str; |
| 692 | fn parameters(&self) -> serde_json::Value; |
| 693 | |
| 694 | async fn execute( |
| 695 | &self, |
| 696 | args: serde_json::Value, |
| 697 | ctx: ToolContext, |
| 698 | ) -> Result<ToolResult, ToolError>; |
| 699 | |
| 700 | fn validate(&self, args: &serde_json::Value) -> Result<(), ToolError> { |
| 701 | let _ = args; |
| 702 | Ok(()) |
| 703 | } |
| 704 | } |
| 705 | |
| 706 | #[derive(Debug, thiserror::Error)] |
| 707 | pub enum ToolError { |
no outgoing calls
no test coverage detected