stynx_code_tools/infrastructure/
cron_delete_tool.rs1use stynx_code_errors::AppResult;
2use stynx_code_types::{PermissionLevel, Tool};
3use serde_json::{Value, json};
4
5pub struct CronDeleteTool;
6
7impl CronDeleteTool {
8 pub fn new() -> Self {
9 Self
10 }
11}
12
13#[async_trait::async_trait]
14impl Tool for CronDeleteTool {
15 fn name(&self) -> &str {
16 "cron_delete"
17 }
18
19 fn description(&self) -> &str {
20 "Delete an existing cron job by its ID."
21 }
22
23 fn input_schema(&self) -> Value {
24 json!({
25 "type": "object",
26 "properties": {
27 "cron_id": {
28 "type": "string",
29 "description": "The ID of the cron job to delete"
30 }
31 },
32 "required": ["cron_id"]
33 })
34 }
35
36 fn permission_level(&self) -> PermissionLevel {
37 PermissionLevel::Dangerous
38 }
39
40 async fn execute(&self, input: Value) -> AppResult<String> {
41 let cron_id = input
42 .get("cron_id")
43 .and_then(|v| v.as_str())
44 .ok_or_else(|| stynx_code_errors::AppError::Tool("missing 'cron_id' field".into()))?;
45
46 tracing::info!(cron_id, "deleting cron job (stub)");
47
48 Ok(format!("Cron job '{cron_id}' deleted successfully."))
49 }
50}