feat(trash): MCP delete tools soft-delete via trash; add delete_task/project/milestone

This commit is contained in:
2026-05-28 21:10:13 -04:00
parent eb41e772cd
commit c3af24ef51
6 changed files with 63 additions and 17 deletions
+13
View File
@@ -23,6 +23,7 @@ from fabledassistant.services import notes as notes_svc
from fabledassistant.services import planning as planning_svc
from fabledassistant.services import rulebooks as rulebooks_svc
from fabledassistant.services import task_logs as task_logs_svc
from fabledassistant.services import trash as trash_svc
async def list_tasks(
@@ -197,6 +198,17 @@ async def start_planning(project_id: int, title: str) -> dict:
)
async def delete_task(task_id: int) -> dict:
"""Move a Scribe task (or plan) to the trash (recoverable). Sub-tasks go with it.
Restore via restore(batch_id)."""
uid = current_user_id()
batch = await trash_svc.delete(uid, "task", task_id)
if batch is None:
raise ValueError(f"task {task_id} not found")
return {"deleted_batch_id": batch,
"message": f"Task {task_id} moved to trash. Restore with restore('{batch}')."}
def register(mcp) -> None:
for fn in (
list_tasks,
@@ -205,5 +217,6 @@ def register(mcp) -> None:
update_task,
add_task_log,
start_planning,
delete_task,
):
mcp.tool(name=fn.__name__)(fn)