(&self, args: &serde_json::Value, ctx: &ToolContext)
| 95 | } |
| 96 | |
| 97 | async fn execute(&self, args: &serde_json::Value, ctx: &ToolContext) -> Result<ToolOutput> { |
| 98 | let Some(kind) = args.get("type").and_then(|value| value.as_str()) else { |
| 99 | return Ok(ToolOutput::error("type parameter is required")); |
| 100 | }; |
| 101 | if kind != "script" { |
| 102 | return Ok(ToolOutput::error(format!( |
| 103 | "Unsupported program type: {kind}. Only \"script\" is supported." |
| 104 | ))); |
| 105 | } |
| 106 | let inputs = args |
| 107 | .get("inputs") |
| 108 | .cloned() |
| 109 | .unwrap_or_else(|| serde_json::json!({})); |
| 110 | |
| 111 | execute_script_program(args, inputs, Arc::clone(&self.registry), ctx).await |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | #[derive(Debug, Deserialize)] |
no test coverage detected