Add delete_context_workspace tool

This commit is contained in:
Riz Ashraf committed 2026-09-27 10:10:30 +01:00
1 parent 0699b603c1
commit bb535b62b0
4 files changed
+50 -2

No files matched your search

+35
View File
@@ -277,6 +277,41 @@ impl McpTool for ListContextWorkspacesHandler {
}
}
pub struct DeleteContextWorkspaceHandler;
#[async_trait]
impl McpTool for DeleteContextWorkspaceHandler {
fn name(&self) -> &'static str {
"delete_context_workspace"
}
fn schema(&self) -> Value {
crate::mcp::tool_def::<crate::tools::DeleteContextWorkspaceTool>(
"delete_context_workspace",
"Delete a saved context workspace",
)
}
async fn execute(&self, args: Value, state: Arc<MemoryState>) -> Result<String, String> {
let req: crate::tools::DeleteContextWorkspaceTool =
serde_json::from_value(args).map_err(|e| e.to_string())?;
let mut found = false;
state.context_workspaces.modify(|ws| {
if let Some(pos) = ws.iter().position(|w| w.namespace == req.namespace && w.name == req.name) {
ws.remove(pos);
found = true;
}
});
if found {
Ok("Context workspace deleted successfully".to_string())
} else {
Err("Context workspace not found".to_string())
}
}
}
pub struct AddPrChecklistItemHandler;
#[async_trait]