Skip to main content

stynx_code_tools/infrastructure/
team_delete_tool.rs

1use stynx_code_errors::AppResult;
2use stynx_code_types::{PermissionLevel, Tool};
3use serde_json::{Value, json};
4
5pub struct TeamDeleteTool;
6
7impl TeamDeleteTool {
8    pub fn new() -> Self {
9        Self
10    }
11}
12
13#[async_trait::async_trait]
14impl Tool for TeamDeleteTool {
15    fn name(&self) -> &str {
16        "team_delete"
17    }
18
19    fn description(&self) -> &str {
20        "Delete an existing agent team by its ID."
21    }
22
23    fn input_schema(&self) -> Value {
24        json!({
25            "type": "object",
26            "properties": {
27                "team_id": {
28                    "type": "string",
29                    "description": "The ID of the team to delete"
30                }
31            },
32            "required": ["team_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 team_id = input
42            .get("team_id")
43            .and_then(|v| v.as_str())
44            .ok_or_else(|| stynx_code_errors::AppError::Tool("missing 'team_id' field".into()))?;
45
46        tracing::info!(team_id, "deleting team (stub)");
47
48        Ok(format!("Team '{team_id}' deleted successfully."))
49    }
50}