refactor: drop Manage prefix from consolidated smart MCP tools
This commit is contained in:
1 parent
e45db33297
commit
961abb01e7
8 files changed
+914
-100
No files matched your search
@@ -524,6 +524,109 @@ impl McpTool for ListTechDebtHandler {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct DecisionsHandler;
|
||||
|
||||
#[async_trait]
|
||||
impl McpTool for DecisionsHandler {
|
||||
fn name(&self) -> &'static str {
|
||||
"decisions"
|
||||
}
|
||||
|
||||
fn schema(&self) -> Value {
|
||||
crate::mcp::tool_def::<DecisionsTool>(
|
||||
"decisions",
|
||||
"Consolidated Architectural Decision Records (ADRs) management (log, query, delete)",
|
||||
)
|
||||
}
|
||||
|
||||
async fn execute(&self, args: Value, state: Arc<MemoryState>) -> crate::error::Result<String> {
|
||||
let req: DecisionsTool = serde_json::from_value(args).map_err(|e| e.to_string())?;
|
||||
let ns = req.namespace.unwrap_or_else(|| crate::models::default_namespace());
|
||||
match req.action {
|
||||
DecisionAction::Log => {
|
||||
let title = req.title.ok_or_else(|| {
|
||||
crate::error::AppError::Internal("title is required for 'log' action".to_string())
|
||||
})?;
|
||||
let status = req.status.unwrap_or_else(|| "accepted".to_string());
|
||||
let context = req.context.unwrap_or_default();
|
||||
let decision = req.decision.unwrap_or_default();
|
||||
let consequences = req.consequences.unwrap_or_default();
|
||||
LogDecisionHandler.execute(
|
||||
serde_json::json!({
|
||||
"title": title,
|
||||
"status": status,
|
||||
"context": context,
|
||||
"decision": decision,
|
||||
"consequences": consequences,
|
||||
"namespace": ns
|
||||
}),
|
||||
state,
|
||||
).await
|
||||
}
|
||||
DecisionAction::Query => {
|
||||
QueryDecisionsHandler.execute(serde_json::json!({"query": req.query, "namespace": ns}), state).await
|
||||
}
|
||||
DecisionAction::Delete => {
|
||||
let id = req.id.ok_or_else(|| {
|
||||
crate::error::AppError::Internal("id is required for 'delete' action".to_string())
|
||||
})?;
|
||||
DeleteDecisionHandler.execute(serde_json::json!({"id": id}), state).await
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TechDebtHandler;
|
||||
|
||||
#[async_trait]
|
||||
impl McpTool for TechDebtHandler {
|
||||
fn name(&self) -> &'static str {
|
||||
"tech_debt"
|
||||
}
|
||||
|
||||
fn schema(&self) -> Value {
|
||||
crate::mcp::tool_def::<TechDebtTool>(
|
||||
"tech_debt",
|
||||
"Consolidated technical debt management (log, resolve, list)",
|
||||
)
|
||||
}
|
||||
|
||||
async fn execute(&self, args: Value, state: Arc<MemoryState>) -> crate::error::Result<String> {
|
||||
let req: TechDebtTool = serde_json::from_value(args).map_err(|e| e.to_string())?;
|
||||
let ns = req.namespace.unwrap_or_else(|| crate::models::default_namespace());
|
||||
match req.action {
|
||||
TechDebtAction::Log => {
|
||||
let desc = req.description.ok_or_else(|| {
|
||||
crate::error::AppError::Internal("description is required for 'log' action".to_string())
|
||||
})?;
|
||||
let ideal = req.ideal_solution.unwrap_or_default();
|
||||
LogTechDebtHandler.execute(
|
||||
serde_json::json!({
|
||||
"description": desc,
|
||||
"ideal_solution": ideal,
|
||||
"git_commit": req.git_commit,
|
||||
"git_branch": req.git_branch,
|
||||
"symbol_references": req.symbol_references,
|
||||
"line_range": req.line_range,
|
||||
"namespace": ns
|
||||
}),
|
||||
state,
|
||||
).await
|
||||
}
|
||||
TechDebtAction::Resolve => {
|
||||
let id = req.id.ok_or_else(|| {
|
||||
crate::error::AppError::Internal("id is required for 'resolve' action".to_string())
|
||||
})?;
|
||||
ResolveTechDebtHandler.execute(serde_json::json!({"id": id}), state).await
|
||||
}
|
||||
TechDebtAction::List => {
|
||||
let inc = req.include_resolved.unwrap_or(false);
|
||||
ListTechDebtHandler.execute(serde_json::json!({"include_resolved": inc, "namespace": ns}), state).await
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct OmniSearchHandler;
|
||||
|
||||
#[async_trait]
|
||||
|
||||
Reference in new issue
Block a user