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
@@ -512,6 +512,145 @@ impl McpTool for ListMilestonesHandler {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TasksHandler;
|
||||
|
||||
#[async_trait]
|
||||
impl McpTool for TasksHandler {
|
||||
fn name(&self) -> &'static str {
|
||||
"tasks"
|
||||
}
|
||||
|
||||
fn schema(&self) -> Value {
|
||||
crate::mcp::tool_def::<TasksTool>(
|
||||
"tasks",
|
||||
"Consolidated task management (add, update, delete, list, set_criteria, verify)",
|
||||
)
|
||||
}
|
||||
|
||||
async fn execute(&self, args: Value, state: Arc<MemoryState>) -> crate::error::Result<String> {
|
||||
let req: TasksTool = serde_json::from_value(args).map_err(|e| e.to_string())?;
|
||||
match req.action {
|
||||
TaskAction::Add => {
|
||||
let title = req.title.ok_or_else(|| {
|
||||
crate::error::AppError::Internal("title is required for 'add' action".to_string())
|
||||
})?;
|
||||
let description = req.description.unwrap_or_default();
|
||||
let add_args = serde_json::json!({
|
||||
"title": title,
|
||||
"description": description,
|
||||
"git_branch": req.git_branch,
|
||||
"parent_id": req.parent_id,
|
||||
"dependencies": req.dependencies,
|
||||
});
|
||||
AddTaskHandler.execute(add_args, state).await
|
||||
}
|
||||
TaskAction::Update => {
|
||||
let id = req.id.ok_or_else(|| {
|
||||
crate::error::AppError::Internal("id is required for 'update' action".to_string())
|
||||
})?;
|
||||
let status = req.status.ok_or_else(|| {
|
||||
crate::error::AppError::Internal("status is required for 'update' action".to_string())
|
||||
})?;
|
||||
let update_args = serde_json::json!({
|
||||
"id": id,
|
||||
"status": status,
|
||||
});
|
||||
UpdateTaskStatusHandler.execute(update_args, state).await
|
||||
}
|
||||
TaskAction::Delete => {
|
||||
let id = req.id.ok_or_else(|| {
|
||||
crate::error::AppError::Internal("id is required for 'delete' action".to_string())
|
||||
})?;
|
||||
let del_args = serde_json::json!({
|
||||
"id": id,
|
||||
});
|
||||
DeleteTaskHandler.execute(del_args, state).await
|
||||
}
|
||||
TaskAction::List => {
|
||||
let list_args = serde_json::json!({
|
||||
"git_branch": req.git_branch,
|
||||
"summary_level": req.summary_level,
|
||||
"max_tokens": req.max_tokens,
|
||||
});
|
||||
ListActiveTasksHandler.execute(list_args, state).await
|
||||
}
|
||||
TaskAction::SetCriteria => {
|
||||
let id = req.id.ok_or_else(|| {
|
||||
crate::error::AppError::Internal("id is required for 'set_criteria' action".to_string())
|
||||
})?;
|
||||
let criteria = req.criteria.ok_or_else(|| {
|
||||
crate::error::AppError::Internal("criteria array is required for 'set_criteria' action".to_string())
|
||||
})?;
|
||||
let set_args = serde_json::json!({
|
||||
"id": id,
|
||||
"acceptance_criteria": criteria,
|
||||
});
|
||||
SetAcceptanceCriteriaHandler.execute(set_args, state).await
|
||||
}
|
||||
TaskAction::Verify => {
|
||||
let id = req.id.ok_or_else(|| {
|
||||
crate::error::AppError::Internal("id is required for 'verify' action".to_string())
|
||||
})?;
|
||||
let verify_args = serde_json::json!({
|
||||
"id": id,
|
||||
});
|
||||
VerifyAcceptanceCriteriaHandler.execute(verify_args, state).await
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct MilestonesHandler;
|
||||
|
||||
#[async_trait]
|
||||
impl McpTool for MilestonesHandler {
|
||||
fn name(&self) -> &'static str {
|
||||
"milestones"
|
||||
}
|
||||
|
||||
fn schema(&self) -> Value {
|
||||
crate::mcp::tool_def::<MilestonesTool>(
|
||||
"milestones",
|
||||
"Consolidated milestone management (add, update, list)",
|
||||
)
|
||||
}
|
||||
|
||||
async fn execute(&self, args: Value, state: Arc<MemoryState>) -> crate::error::Result<String> {
|
||||
let req: MilestonesTool = serde_json::from_value(args).map_err(|e| e.to_string())?;
|
||||
match req.action {
|
||||
MilestoneAction::Add => {
|
||||
let title = req.title.ok_or_else(|| {
|
||||
crate::error::AppError::Internal("title is required for 'add' action".to_string())
|
||||
})?;
|
||||
let add_args = serde_json::json!({
|
||||
"title": title,
|
||||
"namespace": req.namespace.unwrap_or_else(|| crate::models::default_namespace()),
|
||||
});
|
||||
AddMilestoneHandler.execute(add_args, state).await
|
||||
}
|
||||
MilestoneAction::Update => {
|
||||
let id = req.id.ok_or_else(|| {
|
||||
crate::error::AppError::Internal("id is required for 'update' action".to_string())
|
||||
})?;
|
||||
let status = req.status.ok_or_else(|| {
|
||||
crate::error::AppError::Internal("status is required for 'update' action".to_string())
|
||||
})?;
|
||||
let update_args = serde_json::json!({
|
||||
"id": id,
|
||||
"status": status,
|
||||
});
|
||||
UpdateMilestoneHandler.execute(update_args, state).await
|
||||
}
|
||||
MilestoneAction::List => {
|
||||
let list_args = serde_json::json!({
|
||||
"namespace": req.namespace,
|
||||
});
|
||||
ListMilestonesHandler.execute(list_args, state).await
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in new issue
Block a user