diff --git a/src/tools/mod.rs b/src/tools/mod.rs index cc4e608..a5282a4 100644 --- a/src/tools/mod.rs +++ b/src/tools/mod.rs @@ -20,6 +20,7 @@ use tracing::debug; use crate::config::Config; use crate::context::ResponseContext; +use crate::orchestrator::event::ToolContext; use crate::persistence::Store; use crate::sdk::gitea::GiteaClient; use crate::sdk::kratos::KratosClient; @@ -278,6 +279,25 @@ impl ToolRegistry { allowed } + /// Execute a tool with transport-agnostic context (used by orchestrator). + pub async fn execute_with_context( + &self, + name: &str, + arguments: &str, + ctx: &ToolContext, + ) -> anyhow::Result { + // Delegate to the existing execute with a shim ResponseContext + let response_ctx = ResponseContext { + matrix_user_id: String::new(), + user_id: ctx.user_id.clone(), + display_name: None, + is_dm: ctx.is_direct, + is_reply: false, + room_id: ctx.scope_key.clone(), + }; + self.execute(name, arguments, &response_ctx).await + } + pub async fn execute( &self, name: &str,