Add delete_decision tool for removing redundant ADRs
This commit is contained in:
1 parent
08e0cc390a
commit
70edfa4389
3 files changed
+39
No files matched your search
@@ -76,6 +76,37 @@ impl McpTool for QueryDecisionsHandler {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct DeleteDecisionHandler;
|
||||
|
||||
#[async_trait]
|
||||
impl McpTool for DeleteDecisionHandler {
|
||||
fn name(&self) -> &'static str {
|
||||
"delete_decision"
|
||||
}
|
||||
|
||||
fn schema(&self) -> Value {
|
||||
crate::mcp::tool_def::<crate::tools::DeleteDecisionTool>("delete_decision", "Delete an architectural decision record")
|
||||
}
|
||||
|
||||
async fn execute(&self, args: Value, state: Arc<MemoryState>) -> Result<String, String> {
|
||||
let req: crate::tools::DeleteDecisionTool = serde_json::from_value(args).map_err(|e| e.to_string())?;
|
||||
let mut found = false;
|
||||
state.adrs.modify(|adrs| {
|
||||
if let Some(pos) = adrs.iter().position(|a| a.id == req.id) {
|
||||
adrs.remove(pos);
|
||||
found = true;
|
||||
}
|
||||
});
|
||||
|
||||
if found {
|
||||
state.rebuild_index().await;
|
||||
Ok("Decision deleted successfully".to_string())
|
||||
} else {
|
||||
Err("Decision not found".to_string())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct LogErrorFixHandler;
|
||||
|
||||
#[async_trait]
|
||||
|
||||
Reference in new issue
Block a user